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
-
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); }) -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login