创建网站并制作首页教案,新版大都会app,网站建设中 即将上线html5源代码,流量主小程序怎么赚钱Swipebox是一款支持桌面、移动触摸手机和平板电脑的jquery Lightbox插件。该lightbox插件支持手机的触摸手势#xff0c;支持桌面电脑的键盘导航#xff0c;并且支持视频的播放。 在线预览 源码下载 简要教程 Swipebox是一款支持桌面、移动触摸手机和平板电脑的jQuery Ligh…Swipebox是一款支持桌面、移动触摸手机和平板电脑的jquery Lightbox插件。该lightbox插件支持手机的触摸手势支持桌面电脑的键盘导航并且支持视频的播放。 在线预览 源码下载 简要教程 Swipebox是一款支持桌面、移动触摸手机和平板电脑的jQuery Lightbox插件。Swipebox的特点有 支持手机的触摸手势支持桌面电脑的键盘导航通过jQuery回调提提供CSS过渡效果Retina支持UI图标CSS样式容易定制使用方法 首先在body标签之前或header标签中引入jquery和swipebox js文件。 script srclib/jquery-2.0.3.js/script
script srcsrc/js/jquery.swipebox.js/script 在header标签中引入swipebox.css文件。 link relstylesheet hrefsrc/css/swipebox.css HTML结构 为超链接标签使用指定的class使用title属性来指定图片的标题 a hrefbig/image.jpg classswipebox titleMy Captionimg srcsmall/image.jpg altimage
/a 调用插件 通过.swipebox选择器来绑定该lightbox的swipebox事件 script typetext/javascript;( function( $ ) {$( .swipebox ).swipebox();} )( jQuery );
/script 高级配置 画廊 你可以在超链接标签中添加一个rel属性来分割画廊图片 !-- Gallery 1 --
a relgallery-1 hrefbig/image1.jpg classswipeboximg srcsmall/image1.jpg altimage
/a
a relgallery-1 hrefbig/image2.jpg classswipeboximg srcsmall/image2.jpg altimage
/a
!-- Gallery 2 --
a relgallery-2 hrefbig/image3.jpg classswipeboximg srcsmall/image3.jpg altimage
/a
a relgallery-2 hrefbig/image4.jpg classswipeboximg srcsmall/image4.jpg altimage
/a 视频支持 你可以将一个youtube或vimeo的视频URL放到href属性中该lightbox插件会自动检测它是否是youtube 或 vimeo的视频并用swipebox打开它。 a classswipebox-video relvimeo hrefhttp://vimeo.com/29193046My Videos/a 动态调用画廊 你可以通过一个数组来动态调用你的画廊 $( #gallery ).click( function( e ) {e.preventDefault();$.swipebox( [{ href:big/image1.jpg, title:My Caption }, { href:big/image2.jpg, title:My Second Caption }] );
} ); 检测状态 if ( $.swipebox.isOpen ) {// do stuff
} 可用参数 script typetext/javascript;( function( $ ) {$( .swipebox ).swipebox( {useCSS : true, // false will force the use of jQuery for animationsuseSVG : true, // false to force the use of png for buttonsinitialIndexOnArray : 0, // which image index to init when a array is passedhideCloseButtonOnMobile : false, // true will hide the close button on mobile deviceshideBarsDelay : 3000, // delay before hiding bars on desktopvideoMaxWidth : 1140, // videos max widthbeforeOpen: function() {}, // called before openingafterOpen: null, // called after openingafterClose: function() {} // called after closingloopAtEnd: false // true will return to the first image after the last image is reached} );} )( jQuery );
/script useCSS设置为false将强制lightbox使用jQuery来动画。useSVG设置为flase将lightbox使用png来制作按钮。initialIndexOnArray当lightbox使用数组时使用该参数来设置下标。hideCloseButtonOnMobile设置为true时lightbox将在移动设备上隐藏关闭按钮。hideBarsDelaylightbox在桌面设备上隐藏信息条的延时时间。videoMaxWidthlightbox视频的最大宽度。beforeOpenlightbox打开前的回调函数。afterOpenlightbox打开后的回调函数。afterCloselightbox关闭后的回调函数。loopAtEnd设置为true时lightbox将在播放到最后一张图片时接着返回第一张图片播放。浏览器兼容 Chrome, Safari, Firefox, Opera, IE9, IOS4, Android, windows phone. viahttp://***/Article/21873转载于:https://www.cnblogs.com/liaohuolin/p/4287829.html