Fancybox stop scrolling to center
I want the fancybox to actually scroll with the page so I can see the whole of the fancy box开发者_开发问答. Currently it scrolls to the center, so if you have a small screen you can't see all the content. I have changed the centerOnScroll option but it has had no effect.
Please help. Thanks
List item
$.fancybox({
'width': 950,
'height': 500,
'padding': '0',
'margin': '0',
'scrolling': 'yes',
'autoScale': true,
'overflow':'auto',
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'type': 'iframe',
'href': 'your url',
'hideOnOverlayClick': false,
'overlayOpacity': 0.95,
'showCloseButton': false,
onComplete: function () {
$('#fancybox-outer').css({'background-color':'#FFFFFF','overflow':'auto'});
} })
Also one of the Answer
You just have to disable centering if it is an iphone or an ipod:
/*if its iphone or ipod disregard alignment and dont center*/
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
return ;
}
Just add the following code to the top of the $.fancybox.center function in jquery.fancybox-1.3.4.js
This will prevent the box's bouncing on iphone and ipod touch. but you have to change the url of the script to point to this file or you have to repack this code.
I am currently using fancybox for the modal's in a project with the following settings. These settings make the content remain fixed and allows scrolling of the page.
$.fancybox({
'content': content,
'autoDimensions': true,
'width': 550,
'height': 'auto',
'transitionIn': 'fade',
'transitionOut': 'fade',
'speedIn': 400,
'speedOut': 400,
'padding': 0,
'modal': true
});
Beyond this please post some of your script and markup and maybe I can be of some further help.
Found the rogue piece of code. It was for an iphone fix and I just commented it out...
/*Additional fix for iphone positioning*/
#fancybox-wrap {
position: fixed;
}
In Fancybox 2.0, there is a new option that can be used to allow the box to scroll with the page:
fixed: false,
精彩评论