本实例用到了jquery.imgbox.pack.js库。直接看代码:
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 5 <meta name="keywords" content="" /> 6 <meta name="description" content="" /> 7 <title>3种jQuery弹出大图效果</title> 8 <link rel="stylesheet" href="http://7u2iij.com1.z0.glb.clouddn.com/images_style.css" /> 9 <script type="text/javascript" src="js/jquery.min.js"></script> 10 <script type="text/javascript" src="js/jquery.imgbox.pack.js"></script> 11 <script type="text/javascript"> 12 $(document).ready(function() { 13 $("#pic1").imgbox(); 14 15 $("#pic2").imgbox({ 16 ‘zoomOpacity‘ : true, 17 ‘alignment‘ : ‘center‘ 18 }); 19 20 $("#pic3").imgbox({ 21 ‘speedIn‘ : 0, 22 ‘speedOut‘ : 0, 23 ‘alignment‘ : ‘center‘, 24 ‘overlayShow‘ : true, 25 ‘allowMultiple‘ : false 26 }); 27 }); 28 </script> 29 </head> 30 <body> 31 <!-- 代码 BEGIN --> 32 <div id="content"> 33 <h1>imgBox--图片点击放大示例</h1> 34 <hr /> 35 <div id="images"> 36 <a id="pic1" title="图片一" href="http://7u2iij.com1.z0.glb.clouddn.com/pic1.jpg"><img alt="" src="http://7u2iij.com1.z0.glb.clouddn.com/pic1.jpg" width="150" height="90" /></a> 37 <a id="pic2" title="图片二" href="http://7u2iij.com1.z0.glb.clouddn.com/pic2.jpg"/><img alt="" src="http://7u2iij.com1.z0.glb.clouddn.com/pic2.jpg" width="150" height="90" /></a> 38 <a id="pic3" title="图片三" href="http://7u2iij.com1.z0.glb.clouddn.com/pic3.jpg"><img alt="" src="http://7u2iij.com1.z0.glb.clouddn.com/pic3.jpg" width="150" height="90" /></a> 39 </div> 40 <div><a href="" target="_blank" class="download">本地下载</a></div> 41 </div> 42 <!-- 代码 END --> 43 <div style="text-align:center"> 44 <p>文章来源:<a href="http://www.cnblogs.com/iyitong/" target="_blank">cyt静风</a></p> 45 </div> 46 </body> 47 </html>
时间: 2024-10-13 14:55:57