Foto Sampul

Tab Profil

Kronologi Tentang Teman Foto
Santa Mars

Membuat Background Slide Show


Thursday, September 6, 2012

 
Background Slide Show adalah gambar latar belakang yang bisa berganti-ganti secara otomatis setiap waktu yang telah ditentukan. Background ini disematkan di bagian body dengan posisi 100%.

Background Slide Show ini pertama-tama harus di load dengan JQuery yang biasanya dipasang di atas </head>


<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js' type='text/javascript'></script>
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js' type='text/javascript'></script>


Setelah itu dibagian CSS body, minimal harus ada seperti ini:


body {
   background: black url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTQ9deUZ9MLti1lnSwm6PJbgcR_RyBXp5C1PHpK7440LCrHu0oDjVZ0JkVU1cslmf266JfuYsm1E6H8hAaulqc8K0oST2NsN2E9oX5Azs5VgYE2b0rlAeoumW2vH_YX9wDc1_fktq4mgo/s320/body-santa.jpg) repeat-x fixed top center;
   -moz-background-size:100%;
   -webkit-background-size:100%;
   -o-background-size:100%;
   background-size:100%;
}


Jika sudah terpasang juga, kita harus menambah JavaScript Backround Slide Show di bawah ini:

<script type='text/javascript'>
var ssBG={
  gbr:[
    "http://2.bp.blogspot.com/-jXDDlst7GMc/T1SDEQ72L6I/AAAAAAAAMKc/7C4dD51XSNY/s1600/Windows-8-HD-Wallpapers+%281%29.png",    
    "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeJJJrqbldLYFgh7AANCqN3zAkHrkUAWwRc7pUSFdxuEu5ajiD4UEZMiPTTwCmsUBmE5-O43JFOcTtxJEvpZ1X2RLbUV8ps1dV519hrgByzMo6NEqcyF-sK_pF9vrisCU3RqfeFF4/s1600/Windows+8+xTreme+Edition.jpg",
    "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU1ko6lm4Qe05r_9Jve3UjW9CjHDhgy0gq-DL0I5W40Zlx0UIjhYAC6RHpjsZVWhpen3XAUcxMnyY2bcy2yf_n2nm3fkrxjK3lHGfFV8-TY1fOih3IYnUdopKad8wpmqD5jMVjy3cHjag/s1600/Windows_8_wallpapers_3.jpg",
    "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4wAcdvp9Vhy-nLPlIPjgdtre_fWIIbS0_wuA5leAz-3EDavm1-1KzNsJup9UkkikkdiI5HmKN8OwL5qAV8-uFordrdDBt-b3b3bmB0hHOpdKX7f89WTsxeTbOM48IILt2spHKuMd3Us0/s1600/windows8professional.jpg",
    "http://www.smartearningmethods.com/wp-content/uploads/2012/03/Scenic-Windows-8-9.jpg",
    "http://img225.imageshack.us/img225/4564/39003694.jpg", 
    "http://www.deviantart.com/download/243901871/windows_8_3d_by_faisalharoon-d417nvz.jpg", 
    "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvpqBzRlTQYQuDjQnNYM3g2_wxF-vvRpEOsADbQwt0ik-JlC0M8pKFJcRD6udbRk5EiIEZ5OFQW53MhK8OKEXu06ikxUVQ3B3nAMse3XirGPX_402ooovIfGi21PswdoEqCl0DraPFtWs/s1600/China_Country_4+%28wallpapersbay.blogspot.com%29.jpg",
    "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOss_tgaudOfPLXLEORS4uugA9YrEjKRH8aFU_lNPi1tBn-IhKTgGJt32tVwqq_IUr_6AFpf7FpQalJP_1h94wDIpzAp24qYu5ucgGZE5r11h9RA57jeDDZDi1WBDhTHtVt9UH6RbHe2o/s1600/Rainbow_Wallpapers_(1)+%28wallpapersbay.blogspot.com%29.jpg",
    "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1izcVEHD0vzuHU7CIfkQJXyXiM9pIUFa3cfSSZJhlZplDp-qA4oTXosTqfnjBjo5jyek3W5o8FFUfIUCHMwUAp7mi29yQfQ_bsTd6HVBbNzHOX8-lnazgBlpJqFW-bKFNd3u49fzu8UM/s1600/Creative-Digital-Animal-Wallpapers-24+%28wallpapersbay.blogspot.com%29.jpg", 
    "1.bp.blogspot.com/_KjKudOQDFIw/TIBQjNvqJHI/AAAAAAAADRo/g_FBWqwMKAw/s1600/Thunder_Storm_Wallpapers_%2837%29+%28wallpapersbay.blogspot.com%29.jpg" 
  ],
  now:0,
  SlideMyBG:function(list,style,speed,bgPos,bgSize,bgRep){
    if(!ssBG.SlideMyBG.hasRun){ssBG.SlideMyBG.hasRun=true;
    if(list==null||list==''){list=ssBG.gbr}else{if(typeof list!='object'){list=ssBG.gbr}}
    if(style==null||style==''){style='random'}
    if(speed==null||speed==''){speed=5000}
    if(bgPos==null||bgPos==''){bgPos='top center'}
    if(bgSize==null||bgSize==''){bgSize='100%'}
    if(bgRep==null||bgRep==''){bgRep='repeat'}
    ssBG.gaya=style;ssBG.jeda=speed;ssBG.gbr=list;ssBG.pos=bgPos;ssBG.size=bgSize;ssBG.rep=bgRep;
    ssBG.opt={'background-attachment':'fixed','background-repeat':ssBG.rep,'-moz-background-size':ssBG.size,'background-size':ssBG.size};
    }
    if(ssBG.gaya=='random'){ssBG.gbr=ssBG.gbr.sort(function(){return 0.5-Math.random()})}
    var img=new Image();var brp=ssBG.gbr.length;if(ssBG.now>=brp){ssBG.now=0}
    var gbrSkrng=ssBG.gbr[ssBG.now];ssBG.now++;
    if($('#bg-fader').length==0){$('body').prepend('<div id="bg-fader" style="opacity:0.0;top:0;left:0;width:100%;height:100%;background-color:'+$('body').css('background-color')+'"></div>');$('#bg-fader').css(ssBG.opt);$('body').css(ssBG.opt)}
    $(img).load(function(){
      $('#bg-fader').css({'background-image':'url('+gbrSkrng+')','background-position':ssBG.pos}).animate({opacity:1.0},'slow','linear',function(){
        $('body').css({'background-image':'url('+gbrSkrng+')','background-position':ssBG.pos});
        $(this).animate({opacity:0.0},'slow','linear');
        setTimeout("ssBG.SlideMyBG()",ssBG.jeda);
      });
    }).attr('src',gbrSkrng).error(function(huh){ssBG.SlideMyBG()});
  }
};
</script>

<script type='text/javascript'>$(window).load(function(){ssBG.SlideMyBG()})</script>


Artikel Terkait

4 comments:

Copyright © 2016 | Privasi | SiteMap | Follow | Download Template