Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. How to add functions to Project Thumbnail Grid?

How to add functions to Project Thumbnail Grid?

Scheduled Pinned Locked Moved General Discussion
9 Posts 3 Posters 823 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spontans
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • mariusjopenM Offline
      mariusjopenM Offline
      mariusjopen
      Global Moderator
      wrote on last edited by
      #2

      Dear @spontans

      You do not need this: jQuery( document ).ready(function() {

      Have a closer look here:
      http://laytheme.com/documentation.html#custom-javascript

      Best!

      MArius

      www.mariusjopen.world

      1 Reply Last reply
      0
      • S Offline
        S Offline
        spontans
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • mariusjopenM Offline
          mariusjopenM Offline
          mariusjopen
          Global Moderator
          wrote on last edited by
          #4

          Dear @spontans

          hava a look here

          <script>
          window.laytheme.on("newpage", function(layoutObj, type, obj){
          	jQuery("body").addClass("HALLO");
          });
          </script>
          

          Best

          Marius

          www.mariusjopen.world

          S 1 Reply Last reply
          0
          • mariusjopenM mariusjopen

            Dear @spontans

            hava a look here

            <script>
            window.laytheme.on("newpage", function(layoutObj, type, obj){
            	jQuery("body").addClass("HALLO");
            });
            </script>
            

            Best

            Marius

            S Offline
            S Offline
            spontans
            wrote on last edited by
            #5

            @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");

            });

            1 Reply Last reply
            0
            • mariusjopenM Offline
              mariusjopenM Offline
              mariusjopen
              Global Moderator
              wrote on last edited by
              #6

              Dear @spontans
              ok. I was able to recreate your problem.

              I will check back with Armin.

              Best!

              Marius

              www.mariusjopen.world

              S 1 Reply Last reply
              0
              • mariusjopenM mariusjopen

                Dear @spontans
                ok. I was able to recreate your problem.

                I will check back with Armin.

                Best!

                Marius

                S Offline
                S Offline
                spontans
                wrote on last edited by
                #7

                @mariusjopen Thanks!

                1 Reply Last reply
                1
                • arminunruhA Offline
                  arminunruhA Offline
                  arminunruh
                  Global Moderator
                  wrote on last edited by
                  #8

                  Hey an update is coming out later today.
                  Then you can use:

                  window.laytheme.on('thumbnailgrid_rendered', function(category_id){
                      console.log(category_id);
                  })
                  
                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    spontans
                    wrote on last edited by
                    #9

                    Thank you Marius & Armin,

                    You're golden.

                    1 Reply Last reply
                    1
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    I also code custom websites or custom Lay features.
                    šŸ’æ Email me here: šŸ’æ
                    info@laytheme.com

                    Before you post:
                    1. When using a WordPress Cache plugin, disable it or clear your cache.
                    2. Update Lay Theme and all Lay Theme Addons
                    3. Disable all Plugins
                    4. 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:
                    1. Post a link to where the problem is
                    2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                    3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                    Online Users
                    J
                    jaredh
                    Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                    laytheme.com
                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Search