Monday, 30 April 2012

membuat toolbar dengan efek jQuery dan CSS3



Berikut ialah contoh toolbar dengan efek jQuery dan CSS3

* Cara pembuatannya sebagai berikut
* Masuk ke blogger
* Pilih Rancangan dan masuk ke Edit HTML
* Tekan tombol F3 dan cari kode <head>
* Letakan kode jquery dan CSS dibawah ini  diatas kode <head> atau sebelum kode <head>


<link href='https://sites.google.com/site/jayanaktkj/toolbar/style.css' rel='stylesheet' type='text/css'/>
<script src='https://sites.google.com/site/jayanaktkj/toolbar/jquery-1.3.2.min.js' type='text/javascript'/>
<script type='text/javascript'>

$(document).ready(function(){
   
  //hide toolbar and make visible the &#39;show&#39; button
    $(&quot;span.downarr a&quot;).click(function() {
    $(&quot;#toolbar&quot;).slideToggle(&quot;fast&quot;);
    $(&quot;#toolbarbut&quot;).fadeIn(&quot;slow&quot;);   
  });
 
  //show toolbar and hide the &#39;show&#39; button
  $(&quot;span.showbar a&quot;).click(function() {
    $(&quot;#toolbar&quot;).slideToggle(&quot;fast&quot;);
    $(&quot;#toolbarbut&quot;).fadeOut();   
  });
 
  //show tooltip when the mouse is moved over a list element
  $(&quot;ul#social li&quot;).hover(function() {
        $(this).find(&quot;div&quot;).fadeIn(&quot;fast&quot;).show(); //add &#39;show()&#39;&#39; for IE
    $(this).mouseleave(function () { //hide tooltip when the mouse moves off of the element
        $(this).find(&quot;div&quot;).hide();
    });
  });
 
  //don&#39;t jump to #id link anchor
  $(&quot;.facebook, .twitter, .delicious, .digg, .rss, .stumble, .menutit, span.downarr a, span.showbar a&quot;).click(function() {
   return false;                                        
    });
   
  //show quick menu on click
    $(&quot;span.menu_title a&quot;).click(function() {
        if($(&quot;.quickmenu&quot;).is(&#39;:hidden&#39;)){ //if quick menu isn&#39;t visible
            $(&quot;.quickmenu&quot;).fadeIn(&quot;fast&quot;); //show menu on click
        }
        else if ($(&quot;.quickmenu&quot;).is(&#39;:visible&#39;)) { //if quick menu is visible
      $(&quot;.quickmenu&quot;).fadeOut(&quot;fast&quot;); //hide menu on click
    }
    });
   
    //hide menu on casual click on the page
    $(document).click(function() {
            $(&quot;.quickmenu&quot;).fadeOut(&quot;fast&quot;);
            $(&quot;.quickmenu&quot;).css({&#39;vivibility&#39;: &#39;hidden&#39;});
    });
    $(&#39;.quickmenu&#39;).click(function(event) {
        event.stopPropagation(); //use .stopPropagation() method to avoid the closing of quick menu panel clicking on its elements
    });

       
});
   
</script>

* Dan langkah terakhir cari kode <body> letakan kode dibawah ini diatas atau sebelum kode <body>

<div id='toolbarbut'> <!-- hide button -->
<span class='showbar'><a href='#'>show bar</a></span>

</div>

<div id='toolbar'> <!-- toolbar container -->

<div class='leftside'> <!-- all things in floating left side -->
  <ul id='social'>
    <li><a class='rss' href='#'/><!-- icon -->
      <div class='tip' id='tiprss'><!-- tooltip -->
        <ul>
          <li><a href='alamat-url'>580 Readers</a></li>

          <li><a href='alamat-url'><small>[Subscribe]</small></a></li>
        </ul> 
      </div>
    </li>
    <li><a class='facebook' href='#'/>
      <div class='tip' id='tipfacebook'>
        <ul>
          <li><a href='http://www.facebook.com/sharer.php?u=&quot;%20+%20data:post.url%20+%20&quot;&amp;title=&quot;%20+%20data:post.title%27%20target=%27_blank'>Share Page</a></li>

          <li><a href='alamat-url'>| Profile</a></li>
        </ul> 
      </div> 
    </li>
    <li><a class='twitter' href='#'/>
      <div class='tip' id='tiptwitter'>
        <ul>
          <li><a href='http://twitthis.com/twit?url=&quot; + data:post.url + &quot;&amp;title=&quot; + data:post.title' target='_blank'>ReTweet</a></li>
          <li><a href='alamat-url'>| Profile</a></li>

        </ul> 
      </div>
    </li>
    <li><a class='delicious' href='#'/>
      <div class='tip' id='tipdelicious'>
        <ul>
          <li><a href='alamat-url'>Bookmark</a></li>
          <li><a href='alamat-url'>| Profile</a></li>

        </ul> 
      </div>
    </li>
    <li><a class='digg' href='#'/>
      <div class='tip' id='tipdigg'>
        <ul>
          <li><a href='http://digg.com/submit?url=&quot; + data:post.url + &quot;&amp;title=&quot; + data:post.title' target='_blank'>Digg</a></li>
          <li><a href='alamat-url'>| Profile</a></li>

        </ul> 
      </div>
    </li>
    <li><a class='stumble' href='#'/>
      <div class='tip' id='tipstumble'>
        <ul>
          <li><a href='alamat-url'>Stumble</a></li>
          <li><a href='alamat-url'>| Profile</a></li>

        </ul> 
      </div>
    </li>
  </ul>
</div>

<div class='rightside'> <!-- all things in floating left side -->
  <span class='downarr'> <!-- hide button -->
  <a href='#'/>
  </span>

  <span class='menu_title'>
    <a class='menutit' href='#'>quick menu</a> <!-- quick menu title -->
  </span>
  <div class='quickmenu'>
    <ul> <!-- quick menu list -->
      <li><a href='alamat-url'>Beranda</a></li>
      <li><a href='alamat-url'>Tips dan Trik</a></li>

      <li><a href='alamat-url'>jQuery</a></li>
      <li><a href='alamat-url'>CSS3</a></li>
      <li><a href='alamat-url'>Blog</a></li>
      <li><a href='alamat-url'>Web</a></li>
    </ul>
  </div>
</div>

</div>

0 comments:

Post a Comment

Tinggalkan komentar anda...