Alexandre Plennevaux wrote:
> I just noticed that in example 3 on the demo page: "true modal", if you open
> either example, you scroll the page they move along with it. Does this
> still qualifies as modal ? In my understanding, modal means no interaction
> is possible outside the focused area i.e. the window
I am not sure; my opinion is that a bona fide modal has no place in
a web browser, and we can do our best to mimic them. After all, nothing
can prevent the user from updating their address book, etc. And it is
hard enough to supply them unobtrusively when JS is disabled -- a
special page needs to be created per dialog, containing *only* the
dialog, so that when the "trigger" is clicked the browser redirects to
this page instead of displaying the modal window.
With that said; user interactivity (within the browser's viewport) is
locked to jqModal windows that were passed the focus parameter.
Scrolling around the page (for reference) is allowed, but the user will
not be able to interact with anything outside the window. The scrollbar
could be done away with via callbacks.
Here's my method of "locking" the page position;
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);
});
If you set body overflow to hidden in order to hide the scrollbar..
you'll have to deal with a more complicated solution which involves
positioning.
Anyhow.. I hope this helps. Does anyone think this should be added to
the plugin as DEFAULT behavior for windows passed the focus parameter?
Personally, I prefer the lightweight plugin. I am sick and tired of
bloated and rigid plugins like thickbox (though, I'm confident Klaus's
re-workings will produce a better version 3). Try using thickbox on an
internationalized site with gettext & smarty for on-the-fly
translations... let alone dealing w/ inline event preservation ;) -- my
$0.02.
~ Brice
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/