Thursday, February 27, 2014

Random DIV Loaded

Place on <body> or Layout Page  (blogger support )

<div class="item" >... your content here...</div>
<div class="item" >... your content here...</div>
<div class="item" >... your content here...</div>
<div class="item" >... your content here...</div>

<script type="text/javascript">
var random = Math.floor(Math.random() * $('.item').length);
$('.item').hide().eq(random).show();
</script>


Demo : Refresh this page will change the color of the div as an example on the right

No comments:

Post a Comment