step 1: 引入css样式表
<link rel="stylesheet" type="text/css" href="css/css.css">
step 2:引入js文件
<script type="text/javascript" src="js/ZoomPic.js"></script>
step 3:调用插件函数
<script type="text/javascript"> $(function(){ new ZoomPic("jswbox"); }) </script>
step4:插入html代码
<div id="jswbox"> <pre class="prev">prev</pre> <pre class="next">next</pre> <ul> <li><img src="images/1.jpg" alt="derrick" /></li> <li><img src="images/2.jpg" alt="MAGGIE" /></li> <li><img src="images/3.jpg" alt="许在浩" /></li> <li><img src="images/4.jpg" alt="颜子超" /></li> <li><img src="images/5.jpg" alt="万玲玲" /></li> <li><img src="images/6.jpg" alt="derrick" /></li> <li><img src="images/7.jpg" alt="MAGGIE" /></li> </ul> </div>
===========感谢会员 只看不发了 提供的内容===============
萌新求问,为什么我拿过来还好好的,放到ajax里面加载自己的数据就报错了。。。。
ZoomPic.js:17 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. at ZoomPic.setUp (ZoomPic.js:17) at ZoomPic.initialize (ZoomPic.js:4) at new ZoomPic (ZoomPic.js:2) at HTMLDocument.<anonymous> (HtmlTemplate2.html:46) at i (jquery-1.12.4.min.js:2) at Object.fireWith [as resolveWith] (jquery-1.12.4.min.js:2) at Function.ready (jquery-1.12.4.min.js:2) at HTMLDocument.K (jquery-1.12.4.min.js:2)
Cannot read property 'addEventListener' of undefined