Run script
-
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!
-
Hey dnlbrv!
Please take a look at this:
http://laythemeforum.com:4567/topic/674/random-color-backgroundAnd you need to use "jQuery" instead of "$"
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
Online Users
Forgot your key, lost your files, need a previous Lay Theme or Addon version?
Go to www.laykeymanager.com