Change colour of sitetitle on black row — Not working after update
-
Hi!
I used the code I found in 2 older threads to make my navigation (site title + menu) change from black to white when it's over a black background (class id: blackrow), it was working for a while then I came back in the admin and updated and now it's not working.
Here is the code I am using:
Custom CSS:
/* Nav color change */ .blackrow { background: #0e0e0e; } .white { color: #f2f2f2; }
Custom HTML at bottom:
<!--Nav color change--> <script> var offset = 50; var $blackRows; var $nav; Frontend.GlobalEvents.on("newpageshown", function(layoutObj, type, obj){ $blackRows = jQuery(".blackrow"); $practice = jQuery(".info-centre-top"); $mobiletitle = jQuery(".mobile-title span"); $information = jQuery(".laynav span"); $nav = jQuery(".navbar"); $nav.removeClass("white"); $sitetitle = jQuery(".sitetitle span"); }); jQuery(document).on("scroll", function(){ $blackRows.each(function(){ var rect = this.getBoundingClientRect(); if(rect.top - offset < 0 && rect.bottom - offset > 0){ $sitetitle.addClass("white"); $mobiletitle.addClass("white"); $practice.addClass("white"); $information.addClass("white"); return false; }else{ $sitetitle.removeClass("white"); $mobiletitle.removeClass("white"); $practice.removeClass("white"); $information.removeClass("white"); } }); }); </script>
Does anyone know why it's not working anymore?
Thanks!
-
Dear @acmarion
Apologies for the late reply over the weekend,
It makes me curious that possibly since the last update one of the Classes is now called something slightly different and this has caused a problemHowever
I will forward this To Armin for a deeper look!Thank you for your patience and for using Lay Theme
Best wishes
Sincerely
Richard -
please always post your website address.
can you send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com?
-
@arminunruh I just sent you an email with the info you requested.
Also my website (work in progress) is dev.alexiscoutumarion.com
Thanks!
-
@emidio Armin helped me by looking at the code, here was his answer:
you need to use window.laytheme.on
instead of
Frontend.Globalevents.on
as written in the doc:
http://laytheme.com/documentation.html#custom-javascriptSorry for the late reply, I didn't log in for a while.
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