首頁  >  文章  >  web前端  >  jquery插件jquery.nicescroll實現圖片拖曳位移

jquery插件jquery.nicescroll實現圖片拖曳位移

php中世界最好的语言
php中世界最好的语言原創
2018-04-25 11:41:481373瀏覽

這次給大家帶來jquery插件jquery.nicescroll實現圖片拖曳位移,jquery插件jquery.nicescroll實現圖片拖曳位移的注意事項有哪些,下面就是實戰案例,一起來看一下。

這裡介紹jQuery圖片左右拖曳特效,無捲軸,將多張圖片組合在一起形成的效果,插件使用的是jquery.nicescroll.js,拖曳過程中不會出現捲軸,這樣更美觀了一些,若需要此效果,可參考下方邊框中的程式碼。

運行效果截圖如下:

具體程式碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jquery.nicescroll无滚动条左右拖拽</title>
<style>
*{ margin:0; padding:0; list-style:none;}
img{ border:none;}
#boxscroll {height: 313px;width: 900px;margin:0 auto;overflow: auto;}
#boxscroll p {width:12570px;}
#boxscroll p img {float:left;}
.row {background:#FFFFCC;}
.row2 {background:#66CCFF;}
</style>
<script src="jquery-1.6.2.min.js"></script>
<script src="http://xiazai.jb51.net/201508/yuanma/jquery.nicescroll.js"></script>
<script>
 $(document).ready(function() {
  var nicesx = $("#boxscroll").niceScroll("#boxscroll p",{touchbehavior:true,cursorcolor:"#FF00FF",cursoropacitymax:0.6,cursorwidth:24,usetransition:true,hwacceleration:true,autohidemode:"hidden"});
 });
</script>
</head>
<body>
<p id="boxscroll">
 <p>
 <img src="http://files.jb51.net/file_images/article/201508/2015810124458663.jpg" width="1257" height="313" onmousedown="return false" />
 <img src="http://files.jb51.net/file_images/article/201508/2015810124458663.jpg" width="1257" height="313" onmousedown="return false" />
 <img src="http://files.jb51.net/file_images/article/201508/2015810124458663.jpg" width="1257" height="313" onmousedown="return false" />
 <img src="http://files.jb51.net/file_images/article/201508/2015810124458663.jpg" width="1257" height="313" onmousedown="return false" />
 <img src="http://files.jb51.net/file_images/article/201508/2015810124458663.jpg" width="1257" height="313" onmousedown="return false" />
 <img src="http://files.jb51.net/file_images/article/201508/2015810124458663.jpg" width="1257" height="313" onmousedown="return false" />
 </p>
</p>
</p>
</body>
</html>

相信看了本文案例你已經掌握了方法,更多精彩請關注php中文網其它相關文章!

推薦閱讀:

jQuery實作表單里文字按鈕特效合集

jquery實作帶複選框表格步驟詳解

#

以上是jquery插件jquery.nicescroll實現圖片拖曳位移的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn