jalert,jconfirm,jimportant,jprompt,把对应的jquery.alerts.css文件也做修改即可。
2、由jquery.alerts.js中的
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
repositionOnResize: true, // re-centers the dialog on window resize
overlayOpacity: 0.4, // transparency level of overlay
overlayColor: '#FFF', // base color of overlay
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
okButton: ' OK ', // text for the OK button
cancelButton: ' Cancel ', // text for the Cancel button
dialogClass: null,
可以知道jAlert的弹出框都是默认为中间位置的,在使用时
先初始化弹出框对象
jAlert("hello world
controlJalert();
function controlJalert(){
$("#popup_panel").css("display");//可以隐藏弹出框上面的“是”和“否”按钮(如果有的话)
jQuery.alerts._overlay("hide");//去掉弹出框的遮罩层
//下面的几行是重定位弹出框的初始位置在页面瓦面的右下角,因为jquery.jalert.js中默认弹出框在页面中心位置
var top = ($(window).height() - $("#popup_container").outerHeight() );
var left = ($(window).width() - $("#popup_container").outerWidth() ) ;
if( top < 0 ) top = 0;
if( left < 0 ) left = 0;
// IE6 fix
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
$("#popup_container").css({
top: $(window).height() + 'px',
left: left + 'px'
});
$("#popup_container").animate({top: top + 'px',left: left + 'px'});//现在是在页面外面的右下角,所以看不到
//下面这行是以滑动方式弹出,效果为滑动弹出广告的方式
setTimeout('$("#popup_container").animate({top: $(window).height()+"px",left:$(window).width() - $("#popup_container").outerWidth() + "px"});',5000);
//6秒后自动消失
setTimeout('$(\\'#popup_ok\\').trigger(\\'click\\');',6000);
}下载本文