Skip to content

Instantly share code, notes, and snippets.

@raygig
Created March 4, 2015 15:04
Show Gist options
  • Save raygig/2aa37249bd33f916321a to your computer and use it in GitHub Desktop.
Save raygig/2aa37249bd33f916321a to your computer and use it in GitHub Desktop.
iframe popup resize
try {
parent.FF.popup.resize(document);
} catch(e) {}
FF.popup = {
resize: function(d,w,h,options) {
options = options ? options : {};
options.inner = options.inner==undefined ? true : options.inner;
options.height = options.height==undefined ? true : options.height;
options.width = options.width==undefined ? false : options.width;
options.force = options.force==undefined ? false : options.force;
b = $(d).find("body");
w = w ? w : b.width();
h = h ? h : b.outerHeight(true);
r = bheight<b.outerHeight(true);
_cb = $.fn["colorbox"];
if((_cb.options.scrolling==false && r) || options.force) {
if(h>wheight) {
b.css("overflow-y","auto");
biframe.attr("scrolling","yes");
options.scrolling = false;
options.height = wheight;
} else {
if(options.inner) {
if(options.height)
options.innerHeight = options.innerHeight ? options.innerHeight : h;
if(options.width)
options.innerWidth = options.innerWidth ? options.innerWidth : w;
} else {
if(options.height)
options.height = options.height ? options.height : h;
if(options.width)
options.width = options.width ? options.width : w;
}
}
_cb.resize(options);
}
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment