Lượt truy cập: .

Icon

Thứ Bảy, 13 tháng 10, 2012

Tạo hiệu ứng TẮT ĐIỆN cho Blog - Sưu tầm và chia sẻ mã (Code) nhúng Blog (Java Script/HTML)

Mẫu
<script type="text/javascript" src="http://nl-bloggervn-data.googlecode.com/files/jquery.min.js"></script>
<script type="text/javascript">
(function(){
   var im2 = new Image();
   im2.src = 'https://lh4.googleusercontent.com/-27STHLpx62Y/UHkriE4W7bI/AAAAAAAAD8s/BdCPnQNz2T4/s800/nL-Mus%25202.jpg';
   jQuery(function($){
      var w = $(window), dimmer = $('<div style="position:fixed;z-index:-1;top:0;left:0;display:none;background-color:#000;"><\/div'),
      im1 = $('#onoff').toggle(lightsOut, lightsOn).css({zIndex: 11, position: 'relative', cursor: 'pointer'}).attr('src');
      function dresize(){dimmer.css({height: w.height(), width: w.width()});}
      function lightsOut(){this.title = this.alt = 'Lights On'; this.src = im2.src; dimmer.stop().css({zIndex: 10}).animate({opacity: 0.85, duration: 'slow'});}
      function lightsOn(){this.title = this.alt = 'Lights Off'; this.src = im1; dimmer.stop().css({zIndex: -1}).animate({opacity: 0, duration: 'slow'});}
      dresize();
      $('body').append(dimmer.css({opacity: 0, display: 'block'}));
      w.resize(dresize);
   });
})();
</script>
<img id="onoff" src="https://lh3.googleusercontent.com/-IXW6ox_76DQ/UHkriPbRziI/AAAAAAAAD8w/mE3OYNJ7zBs/s800/nL-Mus.jpeg" width="alt=" lights off" title="lights off" /><br />

Không có nhận xét nào:

Đăng nhận xét

Bài đăng ngẫu nhiên

Bài đăng ngẫu nhiên từ nL-BloggerVN

Liên kết tiện ích từ đây

Chưa có
Kiểm tra mã nhúng
Sẽ không hiển thị nếu "Mã" bị lỗi, khi đó bạn hãy sửa lại "Mã" ngay tại khung bên trái! Chương trình ứng dụng chính xác cho các loại mã Java Script; HTML. Chúc bạn thành công !


Diệt Virut - Spyware



 

Tham Gia Và Kết Nối Bạn Bè

Bình Luận Trên Facebook