Hi all, I need to show a hoverbox when the user hovers their mouse over an image. Anyone done this or know how to implement it in Sitejet using custom code? Currently Sitejet only allows an overlay to show on element scrolled into view or page load. Should I just design an overlay to work when scrolled into view and then edit the CSS to work on hover instead? Thanks
Hi Paul! Welcome to SiteJet Community!
Here is how you can do a HoverBox in SiteJet (no audio)
Here is the (s)css Iāve used:
body:not(.edit){
.hoverbox{
//React on hover
&:hover{
.hoverbox-hover-container{
opacity: 1;
}
}
//Initial css props
position: relative;
.hoverbox-hover-container{
transition: all 0.3s ease;
position: absolute;
top:0;
left: 0;
width: 100%;
height:100%;
opacity: 0;
.inner{
//Align hover content in center
display: flex;
align-content: center;
justify-content: center;
text-align: center; //for text
}
}
}
}
Thanks Lucian for the quick response. Iāve just started the site today so will test this out soon and let you know how I get on!
Hi Lucian - how can I create a popup that appears as a separate box on mouseover/hover? See attached image, where user hovers mouse over Logo box then a logo popup/overlay appears.
Thanks
Paul
Hi! Right now, in SiteJet you canāt trigger an overlay from a āmouse hoverā event but, you can set to display the overlay on click, see how is done here: Adding overlays - Sitejet Help
Yes Iām aware of the ability to do on-click, but I need to do it on mouseover
Iāve contacted a developer who can hopefully help me.
Thanks
Hi! I donāt know if it helps.
You can raise the click event from the trigger element from the mouseenter event.
It will basically open the overlay popup on mouse hover(enter).
Here is the JS code, just replace the #ed-63954136
with your trigger element ID.
$('#ed-63954136').mouseenter(function(){
$('#ed-63954136 a').trigger('click');
});
Thanks Lucian, my developer came up with something similar:
jQuery("#ed-64263245").mouseenter(function() {
jQuery("#ed-64263320").attr('style','visibility: visible;height: auto;display: block;position: absolute;top: 489px;z-index: 9;');
}).mouseleave(function() {
jQuery("#ed-64263320").attr('style','visibility: hidden;height: auto;display: block;position: absolute;top: 489px;z-index: 0;');
});
However it appears to be bugging out after the user navigates away from the page and back again. Any ideas?
Link to preview site: http://1df4e3-502b8.preview.sitejet.io/
Hi! What I see is that on the Ryeqo Promotional Materials - Ryeqo Digital Launch page the āSALES AIDā overlay is triggered on page load.
Try to set all overlays trigger to āNo automatic triggerā.
I guess this is what I think the issue might beā¦
Itās funny you should say that, because this morning I noticed that as well and asked Sitejet and my dev the same question! I will turn them off and see how it goesā¦
Seems to have done the trick! Thank you Lucian! Although I suspected that, I wouldnāt have probably tried it without confirmation it might be the issue. Legend
Hi Lucian - If āclickā shows the overlay, what is the trigger function to hide the overlay on mouseleave?
Hi Paul, I donāt know how to trigger the close event on the overlay. I donāt know how the Overlay JS works internally.
My solution was more of a āhackā, to use what is currently possible with the Overlay element.
Your developer code directly changes some Overlay CSS properties (like:visibility).
Maybe someone from the SJ Team can help you.
Also, why the aā after the element ID?
Here Iām selecting the A tag of the Button element. The A tag is the actual link.
I tried but they couldnāt help. The problem Iām having is my developerās code seems to work but then the overlays are completely left invisible in the CMS, thus leaving them uneditable in future. Itās as if the CMS is bugged because it is responding to the JS code in the back-end when the code should only be executing on the front-end.
Yesā¦ This is why Iāve used the Button Element to trigger the overlay. I guess the Overlay JS is creating and moving some elements in the page DOM, so I think is not just a simple CSS change.
Iāve changed your dev. code, so it should work only in preview/live (not in the CMS).
jQuery("body:not(.edit) #ed-64263245").mouseenter(function() {
jQuery("#ed-64263320").attr('style','visibility: visible;height: auto;display: block;position: absolute;top: 489px;z-index: 9;');
}).mouseleave(function() {
jQuery("#ed-64263320").attr('style','visibility: hidden;height: auto;display: block;position: absolute;top: 489px;z-index: 0;');
});
P.S. You can create your completely custom overlay mechanism with a bit of JS and CSS (and not use the SiteJet Overlay option). Or try to use https://atomiks.github.io/tippyjs/ ā¦ see if it fits your needs.
Iāve been trying the Show/Hide code instead and that seems to be working better in terms of not messing up the overlays in the DOM.
Will look at your body:not now and see how that goesā¦
Thanks