3D 图片播放焦点图插件 上下垂直3D切换,左右水平3D切换
XML/HTML Code
- <div id="viewport-shadow">
- <a href="#" id="prev" title="go to the next slide"></a>
- <a href="#" id="next" title="go to the next slide"></a>
- <div id="viewport">
- <div id="box">
- <figure class="slide">
- <img src="img/the-battle.jpg">
- </figure>
- <figure class="slide">
- <img src="img/hiding-the-map.jpg">
- </figure>
- <figure class="slide">
- <img src="img/theres-the-buoy.jpg">
- </figure>
- <figure class="slide">
- <img src="img/finding-the-key.jpg">
- </figure>
- <figure class="slide">
- <img src="img/lets-get-out-of-here.jpg">
- </figure>
- </div>
- </div>
- <div id="time-indicator"></div>
- </div>
JavaScript Code
- <script>
- $(function () {
- var $box = $('#box')
- , $indicators = $('.goto-slide')
- , $effects = $('.effect')
- , $timeIndicator = $('#time-indicator')
- , slideInterval = 5000;
- var switchIndicator = function ($c, $n, currIndex, nextIndex) {
- $timeIndicator.stop().css('width', 0);
- $indicators.removeClass('current').eq(nextIndex).addClass('current');
- };
- var startTimeIndicator = function () {
- $timeIndicator.animate({width: '680px'}, slideInterval);
- };
- // initialize the plugin with the desired settings
- $box.boxSlider({
- speed: 1000
- , autoScroll: true
- , timeout: slideInterval
- , next: '#next'
- , prev: '#prev'
- , pause: '#pause'
- , effect: 'scrollVert3d'
- , blindCount: 15
- , onbefore: switchIndicator
- , onafter: startTimeIndicator
- });
- startTimeIndicator();
- // pagination isn't built in simply because it's easy to
- // roll your own with the plugin API methods
- $('#controls').on('click', '.goto-slide', function (ev) {
- $box.boxSlider('showSlide', $(this).data('slideindex'));
- ev.preventDefault();
- });
- $('#effect-list').on('click', '.effect', function (ev) {
- var $effect = $(this);
- $box.boxSlider('option', 'effect', $effect.data('fx'));
- $effects.removeClass('current');
- $effect.addClass('current');
- switchIndicator(null, null, 0, 0);
- ev.preventDefault();
- });
- });
- </script>
原文地址:http://www.freejs.net/article_jiaodiantu_393.html