Rabu, 18 April 2012

Cara membuat beck to top dan bottom otomatis

Cara membuatnya :
  • Dashboard
  • Design
  • Edit HTML
  • Cari kode </body> dan letakan Java script dibawah ini sebelum kode </body> :
  • DEMO
    <div id="staticbuttons" style="position:absolute;">
    <a href="javascript:" onmouseover="myspeed=-thespeed" onmouseout="myspeed=0"><img
    src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7GgElb-cmn0X2Rr-xZrpvqaOXXo2Qi-IlCZrAU_tWSredLav6SJVMHdb43dRZqDfOn0uyqFTaTOCCvVb6-dSx6qRZBL3CCN6iwNhL1FGzjRRM3UsTunDsNAxZM97pPTKB5tr5TG2mKuS5/s1600/deejayhan-up.png" border="0" /></a><br />
    <a href="javascript:" onmouseover="myspeed=thespeed" onmouseout="myspeed=0"><img
    src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLMAfPMUD-JwAdtM7gfYu3_dT6EnzXL9iGil8TbiSSrTrGNVDF8OCUM-8qxgBkFtuzuPlhrB8-0JRPbsGK1jUdqBYkBLN7vVviBasH5Y6ArYpPF2cjInzTu9mnHq6BASqDHx8qT-Ruq2Hi/s1600/deejayhan-down.png" border="0" /></a>
    </div>
    
    <script type='text/javascript'>
    //<![CDATA[
    
    //Script Tombol turun dan naik By Dynamic Drive
    // (www.dynamicdrive.com/dynamicindex2/pagescroller.htm)
    //This credit MUST stay intact for use
    
    var Hoffset=60
    var Voffset=60
    var thespeed=3 //Kecepatan
    
    var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1
    var myspeed=0
    
    var ieHoffset_extra=document.all? 15 : 0
    var cross_obj=document.all? document.all.staticbuttons : document.getElementById? document.getElementById("staticbuttons") : document.staticbuttons
    
    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    function positionit(){
    var dsocleft=document.all? iecompattest().scrollLeft : pageXOffset
    var dsoctop=document.all? iecompattest().scrollTop : pageYOffset
    var window_width=ieNOTopera? iecompattest().clientWidth+ieHoffset_extra : window.innerWidth+ieHoffset_extra
    var window_height=ieNOTopera? iecompattest().clientHeight : window.innerHeight
    
    if (document.all||document.getElementById){
    cross_obj.style.left=parseInt(dsocleft)+parseInt(window_width)-Hoffset+"px"
    cross_obj.style.top=dsoctop+parseInt(window_height)-Voffset+"px"
    }
    else if (document.layers){
    cross_obj.left=dsocleft+window_width-Hoffset
    cross_obj.top=dsoctop+window_height-Voffset
    }
    }
    
    function scrollwindow(){
    window.scrollBy(0,myspeed)
    }
    
    function initializeIT(){
    positionit()
    if (myspeed!=0){
    scrollwindow()
    }
    }
    
    if (document.all||document.getElementById||document.layers)
    setInterval("initializeIT()",20)
    
    //]]>
    </script> 
     Terakhir simpan,dan lihat hasilnya,cukup arahkan kursor pada beck to top makan akan otomatis ke atas tanpa di klik,begitupun sebaliknya :)

0 komentar:

Terimakasih telah berkunjung :D.Silahkan berkomentar dengan baik dan bijak :). No P*rno, No Spam, No Links, No SARA.

◄ Posting Baru Posting Lama ►