How to add functions to Project Thumbnail Grid?
-
Hi
I'm trying to add class and to apply some scripts on Project Thumbnail Grid element, but apparently it loads after the event: "Frontend.GlobalEvents.on("newpageshown", function(layoutObj, type, obj), and my code doesn't apply to it.
For example I'm trying to add a custom class to each of grid's items like this:Frontend.GlobalEvents.on("newpageshown", function(layoutObj, type, obj){
jQuery( document ).ready(function() {
jQuery('.thumbnailgrid-row . thumb').addClass("js-tilt");
});
});But it doesn't work.
Is there a special event that catches the grid after it had completed its loading?Thanks in advance,
Sasha -
Dear @spontans
You do not need this:
jQuery( document ).ready(function() {
Have a closer look here:
http://laytheme.com/documentation.html#custom-javascriptBest!
MArius
-
Thanks MArious,
I've removed the "jQuery( document ).ready(function() {" I tried to relate to grid's elements via:
window.laytheme.on("newpageshown", function(layoutObj, type, obj){
});but it still doesn't work..
Maybe you can please take a look:
http://oliviahild.com/work
(entrance code:19581958)custom script: http://oliviahild.com/wp-content/themes/lay-child/scripts.js
Thanks in advance,
Sasha -
Dear @spontans
hava a look here
<script> window.laytheme.on("newpage", function(layoutObj, type, obj){ jQuery("body").addClass("HALLO"); }); </script>
Best
Marius
-
@mariusjopen said in How to add functions to Project Thumbnail Grid?:
window.laytheme.on("newpage", function(layoutObj, type, obj){
Marius,
That works, but it's not really related to my problem.
The problem is that I cannot add a class to any of the "Project Thumbnail Grid" element..
I do the following and nothing happens.
window.laytheme.on("newpage", function(layoutObj, type, obj){
jQuery("#grid .ph").addClass("js-tilt");
});
-
-
@mariusjopen Thanks!
-
Hey an update is coming out later today.
Then you can use:window.laytheme.on('thumbnailgrid_rendered', function(category_id){ console.log(category_id); })
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