将弹出窗口设置为居中jquery [英] Set the popup window to center jquery

查看:50
本文介绍了将弹出窗口设置为居中jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我以这种方式设置模态jQuery窗口的位置:

Right now I'm setting the position of the modal jQuery window in this way:

   var winH = $(window).height();
   var winW = $(window).width();
    //Set the popup window to center
    $(id).css('top',  winH/2-$(id).height()/2);
    $(id).css('left', winW/2-$(id).width()/2);

当我向下滚动时,如何将popUp居中?

How do I center the popUp when I scroll down?

推荐答案

您可以使用其他CSS样式,尝试 position:fixed

You could just use another CSS style, try position: fixed

这篇关于将弹出窗口设置为居中jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆