jQuery Lightbox和弹出层插件flashy

简介: Flashy.js是一款响应式jQuery Lightbox和弹出层插件

Flashy.js是一款响应式jQuery Lightbox和弹出层插件。该jQuery Lightbox和弹出层插件支持图片,内联内容,iframes,以及vimeo和youtube 视频,功能非常强大。

tx000313.png

在线预览 下载

它的特点还有:

  • 支持项目计数。
  • 支持移动设备的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">

HTML结构
然后在页面中创建一组需要展示的内容,结构如下:

<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 shown
  showClass: 'fx-fadeIn',

  // Applied when a new item is hidden
  hideClass: 'fx-fadeOut'

  // Applied when a new item is shown on prev event
  prevShowClass: 'fx-bounceInLeft',

  // Applied when a new item is shown on next event
  nextShowClass: 'fx-bounceInRight',

  // Applied when the current item is hidden on prev event
  prevHideClass: 'fx-bounceOutRight',

  // Applied when the current item is hidden on next event
  nextHideClass: 'fx-bounceOutLeft'

});

配置参数

Flashy.js插件可用的配置参数有:

$('.mixed').flashy({
   

  // image, inline, ajax, iframe, video
  type: 'image',

  // show title
  title: true,

  // can be any CSS valid unit - px, %, and etc
  width: null,
  height: null,

  // enable/disable gallery mode
  gallery: true, 

  // enable/disable infinite loop
  galleryLoop: true, 

  // show item counter
  galleryCounter: true, 

  // show prev and next navigation controls
  galleryPrevNext: true, 

  // message used in the item counter. If empty, no counter will be displayed
  galleryCounterMessage: '[index] / [total]', 

  // enable/disable swipe on desktop
  gallerySwipeDesktop: true, 

  // enable/disable swipe on mobile devices
  gallerySwipeMobile: true, 

  // set swipe threshold in px
  gallerySwipeThreshold: 100, 

  // enable/disable keyboard navigation with arrows and close with ESC
  keyboard: true, 

  // close lightbox via the close button or overlay click
  overlayClose: false, 

  // additional css classes for customization
  themeClass: null, 

  // enable/Disable video autoplay
  videoAutoPlay: false, 

  // error message displayed when a content fails to load
  loadError: 'Sorry, an error occured while loading the content...'

});
相关文章
|
8月前
|
JavaScript 前端开发
百叶窗效果的jQuery幻灯片插件
百叶窗效果的jQuery幻灯片插件
|
8月前
|
JavaScript
jquery无限循环内容滑块插件
jquery无限循环内容滑块插件
|
8月前
|
JavaScript
简单轻量级的jquery图表插件
简单轻量级的jquery图表插件
|
8月前
|
JavaScript
jQuery响应式内容选项卡插件
jQuery响应式内容选项卡插件
|
8月前
|
JavaScript 前端开发
带完成百分比的jQuery表单插件
带完成百分比的jQuery表单插件
|
8月前
|
JavaScript 内存技术
支持多种动画特效的响应式jQuery幻灯片插件
支持多种动画特效的响应式jQuery幻灯片插件
|
10月前
jQuery+Slick插件实现游戏人物轮播展示切换源码
jQuery+Slick插件实现游戏人物轮播展示切换源码
157 14
|
11月前
|
JavaScript 前端开发
jQuery和CSS3滑动展开菜单按钮插件
这是一款jQuery和CSS3滑动展开菜单按钮插件。该滑动展开菜单按钮在用户点击主菜单按钮之后,子菜单以滑动的方式依次展开
171 21
|
11月前
|
移动开发 JavaScript 前端开发
简单易用的jquery响应式轮播图插件ma5slider
ma5slider是一款简单易用的jquery响应式轮播图插件。该轮播图支持鼠标拖拽,可以通过CSS定制外观,支持无限循环模式,内置水平,垂直和淡入淡出三种轮播图过渡动画效果。
|
11月前
|
JavaScript
jquery文字动画特效插件animatext
jquery文字动画特效插件animatext
299 9