Skip to content

Instantly share code, notes, and snippets.

@mitchellhislop
Created August 3, 2011 15:57
Show Gist options
  • Save mitchellhislop/1122994 to your computer and use it in GitHub Desktop.
Save mitchellhislop/1122994 to your computer and use it in GitHub Desktop.
Switch iFrame code
function switchFrame() {
var currentFrame = $("#iframetograb").attr('src');
var newFrame, buttnTxt, newHeightWrapper, newHeightContent;
if (currentFrame.indexOf("fb") > 0){
newFrame = '';
buttnTxt = 'Click to signup with Facebook';
newHeightWrapper=470;
newHeightContent=430;
}
else{
newFrame = '';
buttnTxt = 'Click here to signup without Facebook';
newHeightWrapper= 640;
newHeightContent=602;
}
$('#iframetograb').attr('src', newFrame);
//use doTimeout to delay this, allowing it to have a chance to load the next frame
$.doTimeout(1500, function(){
$('#switchbutton').attr('value', buttnTxt);
$('#ibox2_wrapper').height(newHeightWrapper);
$('#ibox2_content').height(newHeightContent);
});
return ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment