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 "$"
-
Thanks works perfect!
-
Hey, after put the script in to "custom CSS & HTML" the items in "Customize" section disappear. Is its possible?
-
Sorry, I solved this. No theme bug, the problem was the zomm in the browser.
Thanks!
I don't answer or check forum DMs, please just post on the forum.
Before you post:
Use the Search Feature. Maybe there is already a solution to your issue.
1. Update Lay Theme and all Lay Theme Addons
2. Disable all Plugins
3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
4. Now see if your problem solved itself
5. Go here, see if your problem is listed here:
Troubleshooting
When you post:
1. Post a link to where the problem is
2. If the problem is difficult to explain, post screenshots / link to a video to explain it