简体   繁体   中英

I want to make my popup div fixed to the place

I have a popup on my page, it display on clicking any div on the page. There are multiple divs, with which this popup is associated. Now the issue is if i click on div, popup gets open, but if i scroll, popup also scroll and come to wrong div. How to make it fixed to its associated div after click?

Here is a quick example. I'm hoping this is something like what you're talking about. When the first box is clicked, an alert pops up and stays with the first box when scrolling.

I used simple jQuery to create the popup.

$('.box').click(function() {
    $('.alert').css('display', 'block');
});

http://jsfiddle.net/d8xwev9o/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM