
Flashy.js 是一款响应式 jQuery Lightbox 和弹出层插件。该 jQuery Lightbox 和弹出层插件支持图片,内联内容,iframes,以及 vimeo 和 youtube 视频,功能非常强大。 它的特点还有:
支持项目计数

支持移动设备的 swipe 事件
支持预加载动画
支持键盘导航,和 ESC 键退出
支持视频自动播放
支持无限循环
在页面中引入 flashy.min.css 和 jquery 以及 jquery.flashy.min.js 文件。
<link rel="stylesheet" href="css/flashy.min.css">
<script src="jquery.min.js"></script>
<script src="jquery.flashy.min.js"></script>
如果你需要添加更加炫酷的切换效果,可以引入 effect.css 文件。
<link rel="stylesheet" href="css/effect.css">
然后在页面中创建一组需要展示的内容,结构如下:
<a class="demo" href="image-big.jpg"><img src="image-small.jpg" alt="image alt"/></a>
<a class="demo" data-flashy-type="video" href="https://vimeo.com/271516323">Vimeo</a>
<a class="demo" data-flashy-type="video" href="https://youtu.be/dzNvk80XY9s">YouTube</a>
<a class="demo" data-flashy-type="iframe" href="https://example.com/">iFrame</a>
<a class="demo" data-flashy-type="inline" href="#inline">Inline</a>
<div id="inline" style="display:none">
<div class="inline">
<!--内联内容-->
</div>
</div>
在页面 DOM 元素加载完毕之后,通过下面 flashy()方法来初始化该插件。
$(document).ready(function(){
$('.demo').flashy();
});
或者在初始化是传入配置参数:
$('.demo').flashy({
// Applied when a new item is shownshowClass: 'fx-fadeIn',
// Applied when a new item is hiddenhideClass: 'fx-fadeOut'
// Applied when a new item is shown on prev eventprevShowClass: 'fx-bounceInLeft',
// Applied when a new item is shown on next eventnextShowClass: 'fx-bounceInRight',
// Applied when the current item is hidden on prev eventprevHideClass: 'fx-bounceOutRight',
// Applied when the current item is hidden on next eventnextHideClass: 'fx-bounceOutLeft'
});
Flashy.js 插件可用的配置参数有:
$('.mixed').flashy({
// image, inline, ajax, iframe, videotype: 'image',
// show titletitle: true,
// can be any CSS valid unit - px, %, and etcwidth: null,
height: null,
// enable/disable gallery modegallery: true,
// enable/disable infinite loopgalleryLoop: true,
// show item countergalleryCounter: true,
// show prev and next navigation controlsgalleryPrevNext: true,
// message used in the item counter. If empty, no counter will be displayedgalleryCounterMessage: '[index] / [total]',
// enable/disable swipe on desktopgallerySwipeDesktop: true,
// enable/disable swipe on mobile devicesgallerySwipeMobile: true,
// set swipe threshold in pxgallerySwipeThreshold: 100,
// enable/disable keyboard navigation with arrows and close with ESCkeyboard: true,
// close lightbox via the close button or overlay clickoverlayClose: false,
// additional css classes for customizationthemeClass: null,
// enable/Disable video autoplayvideoAutoPlay: false,
// error message displayed when a content fails to loadloadError: 'Sorry, an error occured while loading the content...'
});
Flashy.js 响应式 jQuery Lightbox 和弹出层插件的 github 地址为:https://github.com/avirtum/flashy
| 演示地址 | 下载地址 |
专业提供WordPress主题安装、深度汉化、加速优化等各类网站建设服务,详询在线客服!
