Cara Membuat Background Bergerak di Blog

Cara Membuat Background Bergerak di Blog

Info unik dari dedealfiandiuga.blogspot.com kali ini mengenai salah satu trik membuat gambar background blog menjadi dinamis. Trik ini menggunakan JQuery sederhana yang dikhususkan untuk membuat gambar background menjadi bergerak (Scrolling Background). Script ini membuat gambar background blog bergerak secara vertikal dari arah bawah ke arah atas. Buat sobat blogger yang ingin mencobanya silakan disimak trik membuat scrolling background berikut ini.


  • Login » blogger.
  • Rancangan » Edit HTML.
  • Apabila anda belum menggunakan kode JQuery silakan anda pasang kode JQuery dibawah ini tepat di atas Kode </Head>.

    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2' type='text/javascript'></script>

  • Copy-Paste kode di bawah ini tepat di atas Kode </Head>.

    <script type='text/javascript'>
    //<![CDATA[
    $(function(){
    // ***
    // Scrolling background
    // ***
    // height of background image in pixels
    var backgroundheight = 4000;

    // get the current minute/hour of the day
    var now = new Date();
    var hour = now.getHours();
    var minute = now.getMinutes();

    // work out how far through the day we are as a percentage - e.g. 6pm = 75%
    var hourpercent = hour / 24 * 100;
    var minutepercent = minute / 30 / 24 * 100;
    var percentofday = Math.round(hourpercent + minutepercent);

    // calculate which pixel row to start graphic from based on how far through the day we are
    var offset = backgroundheight / 100 * percentofday;

    // graphic starts at approx 6am, so adjust offset by 1/4
    var offset = offset - (backgroundheight / 1);

    function scrollbackground() {
    // decrease the offset by 1, or if its less than 1 increase it by the background height minus 1
    offset = (offset < 1) ? offset + (backgroundheight - 1) : offset - 1;
    // apply the background position
    $('body').css("background-position", "50% " + offset + "px");
    // call self to continue animation
    setTimeout(function() {
    scrollbackground();
    }, 70
    );
    }
    // Start the animation
    scrollbackground();
    });

    //]]>
    </script>
  • Copy-Paste Kode CSS di bawah ini tepat di atas Kode </Head> untuk memasang gambar background. Anda dapat mengganti gambar background sesuai dengan yang anda inginkan dengan merubah alamat hosting gambar pada Kode CSS di bawah dengan alamat hosting gambar yang anda pilih.

    <style>
    body {
    background: black url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqsJ485bHRbk6643CYmEYqwafEzWUi6aidDM9_yQwtaFxlsIzGrw2dvPQvD3SCMfTBM2wH2JgTqdVnjqUzGq1tZlSvY1JHjiOEDm7C1erChrGXK-rpCFyPjMe6YiyZUanig7SC6A4leIyp/s800/bg.gifrepeat center; background-attachment: fixed;
    }
    </style>

  • Keterangan :
    repeat // Pengulangan gambar arah x dan y.
    • repeat-x // Pengulangan gambar hanya arah horizontal.
    • repeat-y // Pengulangan gambar hanya arah vertikal.
    http://3.bp.blogspot.com/-tS5lZKl3Qag/TtjQUfMzi2I/AAAAAAAAAkA/QZc2FwvhW4o/s200/bg.gif // URL Link gambar.
    - center // Lokasi gambar berada di tengah layar.
    • Left // Lokasi gambar berada di kiri gambar.
    • Right // Lokasi gambar berada di kanan gambar.

Pilihan Gambar Background 


  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqsJ485bHRbk6643CYmEYqwafEzWUi6aidDM9_yQwtaFxlsIzGrw2dvPQvD3SCMfTBM2wH2JgTqdVnjqUzGq1tZlSvY1JHjiOEDm7C1erChrGXK-rpCFyPjMe6YiyZUanig7SC6A4leIyp/s800/bg.gif

  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU1CQ7jEZlmDRs-Ouyx0txW4NdJJrmYs5DJyc6MNWNj3gOvgVC63xnKV1UZLB10B786ZGpLOSTdpPwwkNnx3aX9q9DDiKcEaALAq09HrV_1mfOOZA_Y4uwk5fph_I8NdzWBOWGb8La5-VA/s800/bg_star.png



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpHcrTzwYTAVtjKBlY4hYoDH9pTzGYjElJBtrsoD988_POLlQHYhPO2-eeLNvjEACQbMByUkUdG20jwhdjLjI6W9YTG0JDGgFXRYI2_N-d4cUvUPk9V1sw3Rl4iFuXW-j1zqbqbTPbBjZu/s800/bg-clouds.jpg



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ9ebs2Xmf9N3MuRJv4fxXrRJdvrEhkeZgja8f78OhoTvDbmkD2nAoJr1uSjlhlmSE1zrgjeb0OvjoA5WKJ-eRWtzwDUqA9Byx2G6m6vqOMXemQP06IWxoxNZydc2UyKbG4u-2kyjO9FWs/s800/skull-fire-monozcore.png

  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB5mLsw9sDAT_mpb8eBygjQvBryXE4Du6eu0w46LDs-TTSPRiiU-RoN3a1kWeg7P19URoHk2LVdEgfe69oB9cHPb3WrZbun8vNZBZHTu2QkkzavkTmNo7PNbCjIEGbdbrHojlBCI3Lh5qm/s800/dance_flow.png



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj30nYbu19gOXIdjpF5bJEtM5HeBytITsljUhKCU5eoE6ZSvMEhbJPItB4ZYeddDPpSxjpzmRVNPkw5fuGCadUFOXkd1lynMAClPGVZzujLZJ8T9QU5V3kyIflosfpYhse5HaE1Uz_5b9O6/s800/ThighHeels.png



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF3Tl6atWKzDMQFnoTveZfjHye2sgqKJktClWqLlsj4kkaN_suvWcz3FYMzeXteVAOdWKzj6WwG-ODMiMWeCIrutjFhADFKBBu0gUKj-JS0589DBLGJFCGXb7X7rohkR0DkhRkvxgL0GM3/s800/animated%2520stars.gif



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_gQ___28gcav9Y-UUVoH8-YHVHdBWpJ5rnJUccmpnJjdEc2aPrCT9ZQgp6DDm7nkiJc1aLq0Ca-bO-zcKE2VvOi5-udjs44qv39j3IVbgmNd6lDhf4JR3nxSMLjlVdv4u9EEmUu3PXB7j/s800/animated%2520blue%2520stars.gif



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzxqCNtOmFFJn5QTMEjqtG9shIEggQEvklb6ymllTOwgBoQuiiubjAcJDusbuC1eb86jz8jYOJHFPgxyTTNnjgsxvdvsxnUnbKaUx2KdVfigoAyrkLLpmPHgoIL-OFdtw5LeizFx8qv5AA/s800/devil_angel_lolita_bg.png


    ----------Selamat Mencoba --------
    ----------Salam Dede's Bloger-------

Share this

Related Posts

First