Hello, I’m a graphic designer that recently (2 months ago) started building websites. I have been using wix but never touched the developer tools. But now I want to make the website a little bit more creative and lively. I looked on the web to know how I can create a button when you hover on it triggers a lightbox (which contains the menu). I found this code but frankly I really don’t know how to use it or if it even works.
import window from ‘wix-window’ ;
export function button8_onMouseIn ( event ) { console . log ( “Mouse over button” )
window . openLightbox ( ‘Lightbox1’ );
}
I have put the code on the page and also the master page, I added the event in properties and made sure the names matched but it still doesn’t work. I will appreciate any help. Thanks in advance!
Definitely more creative and dynamic, that is exactly what I meant. Shows how my knowledge is poor in this. Thanks for the tips. I am going to try but if the code doesn’t work, I don’t know how to fix it. I’ll be back later after trying it.
I’m trying to trigger this lightbox when the mouse hovers on the Donate button. When I try the code above, this is the error I get:
Loading the code for the Donate page. To debug this code, open dwz8l.js in Developer Tools.
Seems like you have components outside of editor flow project. Please, move the component “14e5b36b-e545-88a0-1475-2487df7e9206” to “undefined” project. Making a fallback to the first controller…
Loading the code for the site. To debug this code, open masterPage.js in Developer Tools.
Loading the code for the Home page. To debug this code, open c1dmp.js in Developer Tools.
Could not get staticMediaUrls TypeError: Cannot read properties of undefined (reading ‘media’)
Could not get staticMediaUrls TypeError: Cannot read properties of undefined (reading ‘media’)
Could not get staticMediaUrls TypeError: Cannot read properties of undefined (reading ‘media’)
Could not get staticMediaUrls TypeError: Cannot read properties of undefined (reading ‘media’)
Hi there I do something similar on my site with a custom menu. I think you should absolutely not use a lightbox in the way you are using it, lightboxes are not only difficult for beginners to code (as Mr Ninja pointed out), but they are also notoriously slow to open.
I recommend using a container box instead, setting it to display on all pages. You can check out this post for the proper code. It might be time-consuming to “rebuild” your menu in this way, but in the long-run I think it will be a better experience for your users.