Hi guys, the title says it all! My site has a store page, which once navigated to generates a lightbox, which explains that all items are currently on hold due to Covid-19. When the lighbox closes, it scrolls to the top of the background page - however, I would like it to scroll to #anchor1, which is located between the page banner and the product list on the background page. How can I achieve this with code? This is the only page that a lightbox appears on.
The page is here: notenoughknife.com/store
Thanks in advance,
Matt
Have not tested this, but I expect it to work something like this:
import wixWindow from 'wix-window'; import wixLocation from 'wix-location'; // ... wixWindow.openLightbox("LightboxName") .then( (data) => { // Lightbox closed: // let receivedData = data; OPTIONAL // scroll to your element of choice $w("#myElement").scrollTo(); } );
Scroll-to
https://www.wix.com/velo/reference/wix-window/scrollto
Open Lightbox
https://www.wix.com/velo/reference/wix-window/openlightbox
wix-location
https://www.wix.com/velo/reference/wix-location
Yeah, somehow I deleted the X even though there is the flag to turn it off an on. I'm looking to have the site all done by this weekend, would definitely like to know what you think. This is a site to showcase the amalgamation of the work I've done in the industry in various roles. Art Direction, Lead Artist, Concept artist, etc...
Ha. Well, it seems that the Preview version of the site is the issue. I published the site and now the issue is completely gone. I can open one of the gallery images into a lightbox window and it when it closes the site stays exactly where it was. That was several hours of fighting an issue that wasn't there! Here is the site, feel free to look at it and let me know if the lightbox works for you like it's working for me. Thanks for the help as well!
PS: The site isn't complete, just getting the bones set up right now.
It seems that my issue is I don't want the lightbox to open up automatically. I have several lightboxes that are attached to a gallery, and they open as expected. The only issue I have is when they close the site jumps back to the top. So maybe I need to add a different way of opening the lightboxes?
I'm trying to figure out this exact thing, but I don't know where to input this code? Did you put this on the lightbox itself, or on the page? I have a gallery that I want to use to open a lightbox, then show more images inside the lightbox, then close that and allow people to select other images in the gallery. But when I close the lightbox now it jumps to the top of the page. Your site seems to work great now, so I'm sure I'm just missing something on getting this to work. Thanks for any assistance.