Benjamin Sterling wrote:
>
>     NOTE; I'm not a fan of setting the body overlow to hidden. The
>     reason is
>     you (generally) never know the viewport resolution of your
>     visitors...
>     and having overflow set to hidden while displaying content
>     wider/taller
>     than their screens will have the potential of rendering the page
>     useless.
>
>
> I partially agree with you, to make this truly flexible, have a param 
> to set the scrolls should be there.  Like for your " /True Modal/" the 
> back ground become unusable, for that instance, getting rid of scroll 
> bars should be an option.  I say an option because there may be a 
> situation where the user may want to scroll to go back and read 
> something before hitting yes or no.
>
Ben,

  Getting rid of the bars on taller/wider pages takes a bit of 
positioning voodoo as when the body overflow is set to hidden, you are 
automatically scrolled to the top/left if the viewport was previously in 
a 'illegal' area. The simplest method I came up with is to implement 
"scroll lock". For now this can be done via callbacks from the example 
below. I may include it as a toggable option in future versions of jqModal.

function *scrollLock*(e) {
    var a=e.data.pos;
    window.*scrollTo*(a[0],a[1]);
    return false;
}

function onOpen(h) {
    var a = [
        self.pageXOffset ||
        document.documentElement.*scrollLeft* ||
        document.body.*scrollLeft*
        ,
        self.pageYOffset ||
        document.documentElement.*scrollTop* ||
        document.body.*scrollTop*
        ];
    $(window).bind('*scroll*',{pos: a},*scrollLock*);
    h.w.show(); // display the jqModal window
}

function onClose(h) {
    $(window).unbind('*scroll*',*scrollLock*); // unbinds *lock*
    h.w.jqmClose(); // hides the jqModal window
}

$().ready(function(){
    $('#element')
        .jqm({focus: true},onOpen,onClose);
});

~ Brice

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to