$(window).scroll(function() {
if ($(window).scrollTop() > 200) {
$('#box').css({height:'100px', background-color:'green', overflow:'visible', width:'550px', margin:'0 auto'
});
$('#box2').css({position:'fixed',left:'400px',height:'200px',background: '#CF0'});
}
I am new to javascript, this might as well be a quick question...
What I have here is modifying the css styles of a div (#box) depending on the location of the page you are on (> 200 in this case).
What I am trying to achieve is to add multiple css alterations to #box and to execute a random one each time. For example each time you scroll pass 200 from the very top, the div appears either in height:'100px' with green background, height:'200px' with blue background, OR height:'300px' with red background. Hope this make sense....