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. Randomize thumbnails order in Thumbnail grid

Randomize thumbnails order in Thumbnail grid

Scheduled Pinned Locked Moved General Discussion
9 Posts 6 Posters 321 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.
  • J Offline
    J Offline
    jspinkus
    wrote on last edited by
    #1

    Hi @mariusjopen
    Hope your doing fine in this times of pandemia and isolation.

    Im trying to randomize the order in my projects Thumbnail grid:
    https://www.chamberprojects.com/category/images

    This are the codes I tried, I know they work becuase i tried them in a jsfiddle, but for some reason they are not working in the grid, maybe you can give me a hint:

    <script>
    jQuery(function () {
    var parent = jQuery(".thumb-collection");
    var divs = parent.children();
    while (divs.length) {
    parent.append(divs.splice(Math.floor(Math.random() * divs.length), 1)[0]);
    }
    });
    </script>

    OR:

    <script>
    jQuery(".thumb-collection").php(jQuery(".thumb-collection .thumbnail-wrap").sort(function(){
    return Math.random()-0.5;
    }));
    </script>

    Thank you!

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

      Dear @juanpinkus
      This is a great idea and we will write it down for the future. Right now this is not possible.

      Does this code work on JSfiddle?

      Thank you!
      Marius

      www.mariusjopen.world

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jspinkus
        wrote on last edited by
        #3

        Hi @mariusjopen

        Thanks for answering. Yes, this codes work on JSfiddle

        Here are both examples:
        https://jsfiddle.net/epxwy3tz/
        http://jsfiddle.net/axphy0gv/

        I can't figure out why is not woriking on Laytheme, I tried changing the postition of .thumbnial-wrap to "position: static", and add "float: left", but still not working.

        I'm missing something and I dont know what it is.

        Thank you!
        Juan

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

          its not possible sorry

          F 1 Reply Last reply
          0
          • arminunruhA arminunruh

            its not possible sorry

            F Offline
            F Offline
            Financial
            wrote on last edited by
            #5

            @arminunruh any update on this functionality? I'm reviving an old post because I think it's better than making a new one just to ask this question. Please remove if against the rules.

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

              Dear @Financial

              No need to remove this post, happy to talk on older threads šŸŒ
              Randomizing the order of the Thumbnail grid is still not a built in option and will need to be custom coded.


              Best
              Richard
              1 Reply Last reply
              0
              • F Offline
                F Offline
                Financial
                wrote on last edited by Financial
                #7

                thanks for the reply! any advice on how one would go about custom coding it? is it merely a css issue or...?

                1 Reply Last reply
                0
                • edgrbnzE Offline
                  edgrbnzE Offline
                  edgrbnz
                  wrote on last edited by
                  #8

                  +1

                  for this feature!

                  ✦ ✦ ✦

                  1 Reply Last reply
                  0
                  • RichardR Offline
                    RichardR Offline
                    Richard
                    Global Moderator
                    wrote on last edited by
                    #9

                    Dear @edgrbnz @Financial

                    Have added to the development noted & forwarded to Armin šŸŒ


                    Best
                    Richard
                    1 Reply Last reply
                    0
                    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
                    M
                    mactics
                    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