Adding a URL to a Lightbox | WixCreate | Wix Code - Corvid
 

Wix Tutorial - Adding an URL to a Lightbox using Wix Code

Sometimes it can be handy to have a lightbox have a URL. For instance, in case you send out emails with a link in your signature to a video on your site. You can add the video to a lightbox and only have it show when someone clicks the link to it in your email signature.

Elements:

Lightbox name: urlExample

Wix Code:

import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
function open_Lightbox(){
let query = wixLocation.query;
var goto = query.name;
wixWindow.openLightbox(goto);
}
$w.onReady(function () {
open_Lightbox();
});

The lightbox then will have the following URL:
domainname/?name=lightboxname

Once the code is on a page you can use the URL with any lightbox. If you would like the lightbox to appear when opening another page (not your home page), make sure you add the code to that page and use the following URL:
domainname/pagename/?name=lightboxname

Demo:

On this page, Wix Code has been used to show a Lightbox named urlExample.

 

The above code was used:

To open the lightbox, click the following URL:

https://www.wixcreate.com/adding-a-url-to-a-lightbox/?name=urlExample

Websites designed by WixCreate that use the above Wix Code:

Official Wix Expert & Wix Agency Partner

© 2020 by WIXCreate.com

I  All Rights Reserved  I  info@wixcreate.com  I  202-640-5440

facebook-2.gif