# Lightbox Popup 

**URL:** <https://forum.wixstudio.com/t/lightbox-popup/2781>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [August 10, 2018, 12:09am UTC](https://forum.wixstudio.com/t/lightbox-popup/2781 "2018-08-10T00:09:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anna94](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anna94/32/5775_2.png) [@anna94](https://forum.wixstudio.com/u/anna94)\
**Post date:** [August 10, 2018, 12:09am UTC](https://forum.wixstudio.com/t/lightbox-popup/2781/1 "2018-08-10T00:09:20Z")

</div>

Hi! I’m trying to get a lighbox to pop up when the user scrolls past a specific anchor point. I feel like there is a simple solution to this but am having trouble. Can anybody help me with this?

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 10, 2018, 7:49am UTC](https://forum.wixstudio.com/t/lightbox-popup/2781/2 "2018-08-10T07:49:31Z")

</div>

Hi Anna

You’re right, there is quite a simple solution to this. You can use an anchor and add either the onViewPortEnter / onViewPortLeave event handlers to it depending on your preference, and then simply add this code in between the brackets:

```javascript
import wixWindow from 'wix-window'; // add this to the top of your page
  
  wixWindow.openLightbox("LightboxName"); // add this in between the ancor's curly brackets  

```

Best of luck!  
Tiaan

---

<div class="post-metadata">

**Author:** ![skmedia](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/skmedia/32/5616_2.png) [@skmedia](https://forum.wixstudio.com/u/skmedia)\
**Post date:** [August 10, 2018, 10:47pm UTC](https://forum.wixstudio.com/t/lightbox-popup/2781/3 "2018-08-10T22:47:35Z")

</div>

If you find that a lightbox ends up not working as well for your needs and you need a pinned container instead, I’d recommend using the viewportEnter/leave of some larger element in your page or you could purposefully place some invisible box/strip for this purpose. I find this much better if what you want is your container to pop up when you scroll to the bottom and back to the top of your page!

---

<div class="post-metadata">

**Author:** ![anna94](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anna94/32/5775_2.png) [@anna94](https://forum.wixstudio.com/u/anna94)\
**Post date:** [August 15, 2018, 3:58pm UTC](https://forum.wixstudio.com/t/lightbox-popup/2781/4 "2018-08-15T15:58:58Z")

</div>

Awesome, thank you both so much!

---

<div class="post-metadata">

**Author:** ![rsmith](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/rsmith/32/1443_2.png) [@rsmith](https://forum.wixstudio.com/u/rsmith)\
**Post date:** [February 20, 2021, 1:55am UTC](https://forum.wixstudio.com/t/lightbox-popup/2781/5 "2021-02-20T01:55:04Z")

</div>

I tried this solution but when I preview the page and scroll past the anchor point nothing happens ☹ … Is there anything specific I can do to troubleshoot?

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [February 20, 2021, 5:48am UTC](https://forum.wixstudio.com/t/lightbox-popup/2781/6 "2021-02-20T05:48:17Z")

</div>

@rsmith  
Combine the given CODE by Tiaan and the knowledge which you can get in the following link…  
[https://russian-dima.wixsite.com/meinewebsite/reading-position](https://russian-dima.wixsite.com/meinewebsite/reading-position)

Attention onto the red-line in the example! (it could also be an ANCHOR)!
