Galleriffic-jquery图片画廊插件
?
插件网址:http://www.twospy.com/galleriffic/index.html
?
使用方法:
引入JQ库与插件js
<link rel="stylesheet" href="css/basic.css" type="text/css" /> <link rel="stylesheet" href="css/galleriffic-3.css" type="text/css" /> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type="text/javascript" src="js/jquery.galleriffic.js"></script> <script type="text/javascript" src="js/jquery.opacityrollover.js"></script> <script type="text/javascript" src="js/function.js"></script>
?添加容器html
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>QQ图片</title> <link rel="stylesheet" href="css/basic.css" type="text/css" /> <link rel="stylesheet" href="css/galleriffic-3.css" type="text/css" /> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type="text/javascript" src="js/jquery.galleriffic.js"></script> <script type="text/javascript" src="js/jquery.opacityrollover.js"></script> <script type="text/javascript" src="js/function.js"></script> </head> <body> <div id="page"> <div id="container"> <h1>安全检查相册</h1> <h2>0905</h2> <!-- Start Advanced Gallery Html Containers --> <div id="gallery" class="content"> <div id="controls" class="controls"></div> <div class="slideshow-container"> <div id="loading" class="loader"></div> <div id="slideshow" class="slideshow"></div> </div> <div id="caption" class="caption-container"></div> </div> <div id="thumbs" class="navigation"> <ul class="thumbs noscript"> <c:forEach items="${imageList}" var="img"> <li> <a class="thumb" name="leaf" href="uploadImages/${img}" title="图片"> <img width="100" height="80" src="uploadImages/${img}" alt="图片" /> </a> </li> </c:forEach> </ul> </div> <!-- End Advanced Gallery Html Containers --> <div style="clear: both;"></div> </div> </div> </body> </html>
?初始化插件:
jQuery(document).ready(function($) { // We only want these styles applied when javascript is enabled $('div.navigation').css({'width' : '300px','float':'left'});//导航宽度 $('div.content').css('display', 'block');//内容样式为显示 // Initially set opacity on thumbs and add // additional styling for hover effect on thumbs var onMouseOutOpacity = 0.67;//朦胧系数 $('#thumbs ul.thumbs li').opacityrollover({ mouseOutOpacity: onMouseOutOpacity, mouseOverOpacity: 1.0, fadeSpeed: 'fast',//快速显示 exemptionSelector: '.selected'//选中的图片 }); // Initialize Advanced Galleriffic Gallery var gallery = $('#thumbs').galleriffic({ delay: 2500,//幻灯延时 numThumbs: 10,//分页数量 preloadAhead: 5,//预加载图片的数量 enableTopPager: true,//顶部分页链接 enableBottomPager: true,//底部分页链接 //maxPagesToShow: 7, //显示图片的位置与样式 imageContainerSel: '#slideshow', controlsContainerSel: '#controls', captionContainerSel: '#caption', loadingContainerSel: '#loading', renderSSControls: true,//是否开始幻灯片播放 renderNavControls: true,//右上角的上下页 playLinkText: '幻灯片播放', pauseLinkText: '暂停幻灯片播放', prevLinkText: '‹ 上一张图片', nextLinkText: '下一张图片 ›', nextPageLinkText: '下一页 ›', prevPageLinkText: '‹ 上一页', //enableHistory: true,//是否启用历史记录 autoStart: false,//幻灯片是否自动开始 syncTransitions: true,//同步 defaultTransitionDuration: 900,//右边显示图片的淡入淡出的时间 //幻灯片切换的效果 onSlideChange: function(prevIndex, nextIndex) { // 'this' refers to the gallery, which is an extension of $('#thumbs') this.find('ul.thumbs').children() .eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end() .eq(nextIndex).fadeTo('fast', 1.0); } }); });
?