custom Switch button in footer
-
ok. if you could create a page where you just have like 2 or 3 rows in there. and make the bug happen in this simpler case.
then i can try and fix it. cause this example case is too complex. -
I've made a test page with the same footer operation, let me know if this is better for you: https://benoitlefeuvre.com/test/
thanks!
-
hi
up š§ -
hey oh yea i need to check this out sry
-
in this case, the switch button should be on Artworks, as the page category is data-catid=ā[3]ā and should display the correct content as if Artworks had been clicked.
-
im checking it out now
-
ok it seems like i had a really hard time to understand what the problem was :O
i misunderstood youbasically you just need to trigger a click on one of the buttons
u got two buttons:
.artworks-button
and
.overview-button
and as far as i understand this would be the way to do it:
when you go to a page where you want overview-button to be auto-activated:
window.laytheme.on('newpageshown', function(){ if(jQuery("body").hasClass("slug-home"){ jQuery(".overview-button").click(); } })
basically when you visit the homepage, this will click the overview button using javascript:
but maybe u need to remove this custom js u got here:
this could be in conflict with that click js
i think u just add "selected" classmaybe for styling, instead use the class "expand-link-clicked" cause thats the "active" class
so basically with newpageshown and checking the body class you can find out which page u just landed on.
and then either calljQuery(".overview-button").click();
or
jQuery(".artworks-button").click();
if my previous code was checking the right pages (no idea), it could for example look like
window.laytheme.on('newpageshown', function(){ if(jQuery('body').attr('data-catid') == '[3]'){ jQuery(".artworks-button").click(); } else if(jQuery('body').attr('data-catid') == '[1]'){ jQuery(".overview-button").click(); } })
but basically this was no lay theme bug, you just needed help with your custom code
-
Thanks for your reply. You're right, it's probably not a Lay bug but rather that I need help with my code. I tested it, but unfortunately it doesn't work.
-
:/
can you tell me:
which page should have what button activated??and can u gimme your /wp-admin/ login
can you send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com?
-
<script> window.laytheme.on('newpageshown', function(){ setTimeout(function(){ if(jQuery('body').attr('data-catid') == '[3]'){ if( window.utility.isDesktopOrTabletSize ) { jQuery("#footer .artworks-button").click().addClass("selected"); jQuery("#footer .overview-button").removeClass("selected"); } else { jQuery("#footer-custom-phone-grid .artworks-button").click().addClass("selected"); jQuery("#footer-custom-phone-grid .overview-button").removeClass("selected"); } } else if(jQuery('body').attr('data-catid') == '[1]'){ if( window.utility.isDesktopOrTabletSize ) { jQuery("#footer .overview-button").click().addClass("selected"); jQuery("#footer .artworks-button").removeClass("selected"); } else { jQuery("#footer-custom-phone-grid .overview-button").click().addClass("selected"); jQuery("#footer-custom-phone-grid .artworks-button").removeClass("selected"); } } }, 1000) }) </script>
seems like this code is what was needed
-
Thank you very much for your help and your time. That's exactly what I was looking for š
I also code custom websites or custom Lay features.
šæ Email me here: šæ
info@laytheme.com
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options ā Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it