Home > Web Front-end > JS Tutorial > body text

How to create a pop-up window effect with jQuery

php中世界最好的语言
Release: 2017-12-31 11:36:59
Original
2070 people have browsed it

This time I will show you how to create a pop-up window effect with jQuery. The pop-up window effect is often used in our projects. This article will give you a good analysis.




 
 弹窗
  
  
  
  
  
  

Copy after login


Points used:

jQuery creation:

$('

');

Copy after login

Position of the pop-up window:

oLogin.css('left',($(window).width()-oLogin.outerWidth())/2);
oLogin.css('top',($(window).width()-oLogin.outerHeight())/2);
Copy after login

When the scroll bar scrolls, the position of the pop-up window changes:

$(window).on("resize scroll",function(){
oLogin.css('left',($(window).width()-oLogin.outerWidth())/2+$(window).scrollLeft());
oLogin.css('top',($(window).width()-oLogin.outerHeight())/2+$(window).scrollTop());
   })
Copy after login

I believe you have mastered the method after reading the above introduction. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:


How can ajax read local json

How ES6 uses the Set data structure to operate arrays

About HTTP/2 server push

The above is the detailed content of How to create a pop-up window effect with jQuery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!