Social Icons

Rabu, 22 Januari 2014

Cara Memasang Background Gerak pada Blog

Di susun oleh; @zuhdi-ajaib 

 

Cara Membuat Background Bergerak di Blog

Info unik 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/AVvXsEjESWI_12Wxl9eK-ssUFC93IQ3CzEFWdMLkp598XSM4XF3ti1P91M4O9Sd9GNDRAHYVPyv0AB1wDAyxUoFJz5BJVb9TrmiEFJEa-n1WiajM2Z6Kx6drstGAZ7RbqVncA8a1Vl2w61nT-Q6G/s800/bg.gif) repeat 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/AVvXsEjESWI_12Wxl9eK-ssUFC93IQ3CzEFWdMLkp598XSM4XF3ti1P91M4O9Sd9GNDRAHYVPyv0AB1wDAyxUoFJz5BJVb9TrmiEFJEa-n1WiajM2Z6Kx6drstGAZ7RbqVncA8a1Vl2w61nT-Q6G/s800/bg.gif



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLds-w1CXAVW9_i-ooXiGkKmBKfE5N_PWPsNYNwen3nj6l4DQhTIkMaBZJsVAFC9MtcEYe-rUejjYzRp3tgPQxcsyB0NNwEu7rNUcxqap0crFWLIJSV3FOod3Cov7Z4d3PfHWlxvHDpdD6/s800/bg_star.png



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0HwoMxBCRngic5bzCCeEKj5c0U8QOdWdGjjMbWUUsTXbXS2rXqixFJXvPXLZ-jw1pRu5sukHWPrDTBxZyqgBXzFv_wdu8wGOE8VD3yZ2bKESgxu-e54JGMDS2el379kZj3WWChN0GlQ8I/s800/bg-clouds.jpg



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYhhbfWI-GeM4UDGOntIsMcJu6OLe-fjnhyphenhyphenOk22Brjcu4exyrsS-29d-kSptEfLr_FMyHY3BVIih_jnPORxBRMIAqMBRXoK4NAH7Q59tW3qZhfVKKDtCgtKqx8I5PcVqeXOHJT_yxlA9Lz/s800/skull-fire-monozcore.png



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM9TSZbc5k7xovtJayc9v0IIMr7tw8nP_1r56crXbgQTCqcuRPNarGEhczEmknEU1K0fDFCZnqeMDvFxgop6lkW3fAqVfUTXULtqZWpNoSxl8brKCLEx8_cvNudMDhZ1o5M603GTPalOoP/s800/dance_flow.png



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZmcTYFkMPeAXXB5WIoyDdAp9iC7IaynLPzAcGVUHLqT2sZ-BTbV8A7ZYgMPcvrp3tTq_MfevvftGJkmwhchqjHpAAJck8HnMgp7C9Q221Y7CXEAu5Gwc7l1FmJowSdMu1JVSdYHxgCB4F/s800/ThighHeels.png



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPgm01pMOOw7p0E9pfB3MtJX6AmJ1UKtCzwMBgxb-1EfHcKlASOW1uNdvosv7a0cTWEgFP_iYwizWKJEWpgoiKUjuZvIXxALz7Exh_xIcun8iUt81n4wksSWhpc4pZM2h7ZLFD21lFz_me/s800/animated%2520stars.gif



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFj90PlxSEPAFcHroOw7Cg2Rj2PfCsUpPoHD1tNzd_orxlY8qw2YeW4kB1REr1SPjhQIpUjXL1u6ODGX6Dbh3teMlXfw42OK-PcP_gd4n_n6JYID9nwVT9mKjGI-hCrwq6h6InJuosXrs9/s800/animated%2520blue%2520stars.gif



  • https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgxqaYZD_SYDLuJnEVZFJKefvneN7FTenzSWOOOHkLveTu76mkUZkuYWb9U1Hk3gdVASRNLV9zH17KDEmkdTXaNbvDEKqCvZQWAcHR6kp44BZUWPkAhmZ-6cyWJ2_bG6MPa8tZBi1b433Q/s800/devil_angel_lolita_bg.png
.:Selamat Mencoba:.

Tidak ada komentar:

Posting Komentar

 
animasi  bergerak gif
My Widget