jquery外掛程式jquery.beforeafter.js實現左右拖拽分隔條對比圖片的方法,

來源:互聯網
上載者:User

jquery外掛程式jquery.beforeafter.js實現左右拖拽分隔條對比圖片的方法,

本文執行個體講述了jquery外掛程式jquery.beforeafter.js實現左右拖拽分隔條對比圖片的方法。分享給大家供大家參考。具體如下:

左右拖拽切換對比圖片效果,運行效果後,圖片中間有個拖動條,拖動左右滑動,可看到圖片不一樣的效果,女模特的臉變嫩了,呵呵,其實是用了兩張背景圖片實現的,這就需要jquery.beforeafter.js外掛程式了,拖動時候的小表徵圖不見了,路徑可以在jquery.beforeafter.js中設定,不多說了。

運行效果如下:

線上示範地址如下:

http://demo.jb51.net/js/2015/jquery-beforeafter-js-style-codes/

具體代碼如下:

<!DOCTYPE html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>通過拖拽展示前後圖片對比效果的jQuery外掛程式jquery.beforeafter</title><script type="text/javascript" src="js/jquery-1.6.2.min.js"></script><script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script><script type="text/javascript" src="js/jquery.beforeafter-1.3.min.js"></script><script type="text/javascript">$(function(){  $('#container').beforeAfter({imagePath:'js/'});  $('#container1').beforeAfter({imagePath:'js/'});  $('#container2').beforeAfter({imagePath:'js/'});  $('#container3').beforeAfter({imagePath:'js/'});  $('#container4').beforeAfter({imagePath:'js/'});  $('#container5').beforeAfter({imagePath:'js/'});  $('#container6').beforeAfter({imagePath:'js/'});});</script> <style> html{display : none ; } </style> <script> if( self == top ) {  document.documentElement.style.display = 'block' ;  } else {  top.location = self.location ;  } </script><style type="text/css">body {  background: #ccc;}#content {  margin:0 auto;  width:755px;}#container + div.balinks {<!--margin-left: 200px; -->}</style></head><body><div id="content"><div id="container3"><div><img alt="before" src="images/blonde1_before.jpg" width="326" height="495" /></div><div><img alt="after" src="images/blonde1_after.jpg" width="326" height="495" /></div></div></div></body></html>

希望本文所述對大家的jquery程式設計有所協助。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.