close
 http://stackoverflow.com/questions/16359492/changing-background-image-one-time-on-responsive-background-image

function test() {
$("img").each(function(index) {
$(this).hide();
$(this).delay(5000 * index).fadeIn(5000).fadeOut();
});
}
test();

 

<img src="http://elegantthemes.com/preview/InStyle/wp-content/uploads/2008/11/s-1.jpg" />
<img src="http://elegantthemes.com/preview/InStyle/wp-content/uploads/2008/11/s-3.jpg" />

 

body, html{
margin:0;
padding:0;
position:absolute;
top:0;
background-image: url("http://elegantthemes.com/preview/InStyle/wp-content/uploads/2008/11/s-3.jpg");
}
img{
position:absolute;
top:0;
display:none;
width:100%;
height:100%;
}





$
(function(){var body = $('body');var backgrounds =['url(http://static.jsbin.com/images/jsbin_static.png)','url(http://static.jsbin.com/images/popout.png)'];var current =0;function nextBackground(){ body.css('background', backgrounds[current =++current % backgrounds.length]); setTimeout(nextBackground,5000);} setTimeout(nextBackground,5000); body.css('background', backgrounds[0]);});



http://stackoverflow.com/questions/22075468/jquery-changing-background-image-with-timer
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 amychang2014 的頭像
    amychang2014

    工作需要筆記

    amychang2014 發表在 痞客邦 留言(0) 人氣()