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/topic/674/random-color-backgroundAnd you need to use "jQuery" instead of "$"
-
-
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login