jAlert - Alert does not center correctly on iPad
I am using jAlert to display an alert on bad input. The popup displays roughly 300px from the top. The user may experience an error roughly 2000px down the page, in an area where the popup is not visible. In cases such as this the user doesn't even know the popup occured.
Ideally, the popup should display in the center of the current visible screen area. But, Scrolling up to the top is the next best thing. I'm unsure how to implement either.
The method does not appear to have an overload to accept screen location coordinates.
$(document).ready(function () {
jAlert("Flippin message", "Title");//, function () {
// alert('normal alert');//optional callback
//});
});
How can I best solve this issue?
UPDATE Things work fine in IE/Firefox/Safari(desktop). The issue is just with iPads browse开发者_Go百科r.
Looked into the plugin code and changed this line
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
to
if( $.browser.msie && parseInt($.browser.version) <= 6 || navigator.userAgent.match(/iPad/i)) top = top + $(window).scrollTop();
This seems to work for ipad... and is opening the alert at the center even if I have scrolled my way down the page... Hope it helps... please suggest if there is a better solution...
精彩评论