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. Run script

Run script

Scheduled Pinned Locked Moved General Discussion
5 Posts 2 Posters 547 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.
  • D Offline
    D Offline
    dnlbrv
    wrote on last edited by
    #1

    Hello,
    I need run this script every time you recharge the site. Change the body background-color and background-color in H1

    <script>
    $(document).ready(function(){
    var colors = ['#ff7175','#9fdded', '#ffcccc', '#f9f3a0', '#aeeadd', '#ded3e7', '#e0dcd4'];
    $("body").each(function()
    {
    $(this).css('background-color', colors[Math.floor(Math.random()*colors.length)]);
    $('h1').css('background-color', colors[Math.floor(Math.random()*colors.length)]);
    });
    });
    </script>

    Any idea? when recharge the site the theme put the colors of the preferences.

    Thanxs a lot!

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

      Hey dnlbrv!
      Please take a look at this:
      http://laythemeforum.com:4567/topic/674/random-color-background

      And you need to use "jQuery" instead of "$"

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dnlbrv
        wrote on last edited by
        #3

        Thanks works perfect!

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dnlbrv
          wrote on last edited by
          #4

          Hey, after put the script in to "custom CSS & HTML" the items in "Customize" section disappear. Is its possible?

          Screen Shot 2016-11-07 at 18.39.52.png

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dnlbrv
            wrote on last edited by
            #5

            Sorry, I solved this. No theme bug, the problem was the zomm in the browser.
            Thanks!

            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
            A
            alasdair17
            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