jQuery技术

jQuery实现带滚动导航效果的全屏滚动相册实例

字号+ 作者:H5之家 来源:H5之家 2017-12-12 15:18 我要评论( )

本文实例讲述了jQuery实现带滚动导航效果的全屏滚动相册。分享给大家供大家参考。具体如下: 运行效果图如下: 主要代码如下: ? 1 2 3 4 5 6 7 8 9 10 11 12 13

jQuery实现带滚动导航效果的全屏滚动相册实例

   本文实例讲述了jQuery实现带滚动导航效果的全屏滚动相册。分享给大家供大家参考。具体如下:

  运行效果图如下:

  主要代码如下:

  ?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 $(function() { //加载时的图片 var $loader= $('#st_loading'); //获取的ul元素 var $list= $('#st_nav'); //当前显示的图片 var $currImage = $('#st_main').children('img:first'); //加载当前的图片 //同时显示导航的项 $('<img>').load(function(){ $loader.hide(); $currImage.fadeIn(3000); //滑出导航 setTimeout(function(){ $list.animate({'left':'0px'},500); }, 1000); }).attr('src',$currImage.attr('src')); //计算出将被显示的略缩图所在的div元素的宽度 buildThumbs(); function buildThumbs(){ $list.children('li.album').each(function(){ var $elem = $(this); var $thumbs_wrapper = $elem.find('.st_thumbs_wrapper'); var $thumbs = $thumbs_wrapper.children(':first'); //每张略缩图占有180像素的宽度和3像素的间距(margin) var finalW = $thumbs.find('img').length * 183; $thumbs.css('width',finalW + 'px'); //是这元素具有滚动性 makeScrollable($thumbs_wrapper,$thumbs); }); } //点击菜单项目的时候(向上向下箭头切换) //使略缩图的div层显示和隐藏当前的 //打开菜单(如果有的话) $list.find('.st_arrow_down').live('click',function(){ var $this = $(this); hideThumbs(); $this.addClass('st_arrow_up').removeClass('st_arrow_down'); var $elem = $this.closest('li'); $elem.addClass('current').animate({'height':'170px'},200); var $thumbs_wrapper = $this.parent().next(); $thumbs_wrapper.show(200); }); $list.find('.st_arrow_up').live('click',function(){ var $this = $(this); $this.addClass('st_arrow_down').removeClass('st_arrow_up'); hideThumbs(); }); //点击略缩图,改变大的图片 $list.find('.st_thumbs img').bind('click',function(){ var $this = $(this); $loader.show(); $('<img class="st_preview"/>').load(function(){ var $this = $(this); var $currImage = $('#st_main').children('img:first'); $this.insertBefore($currImage); $loader.hide(); $currImage.fadeOut(2000,function(){ $(this).remove(); }); }).attr('src',$this.attr('alt')); }).bind('mouseenter',function(){ $(this).stop().animate({'opacity':'1'}); }).bind('mouseleave',function(){ $(this).stop().animate({'opacity':'0.7'}); }); //隐藏当前已经打开了的菜单的函数 function hideThumbs(){ $list.find('li.current') .animate({'height':'50px'},400,function(){ $(this).removeClass('current'); }) .find('.st_thumbs_wrapper') .hide(200) .andSelf() .find('.st_link span') .addClass('st_arrow_down') .removeClass('st_arrow_up'); } //是当前的略缩图div层滚动 //当


jQuery实现带滚动导航效果的全屏滚动相册实例:

上一篇:ASP.NET―001:GridView绑定List

下一篇:删除重复字符js代码

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • JQuery获取元素的方法总结

    JQuery获取元素的方法总结

    2017-12-13 13:39

  • jQuery学习之一

    jQuery学习之一

    2017-12-12 11:19

  • jquery鏃爊ew鏋勫缓瀛︿範绗旇

    jquery鏃爊ew鏋勫缓瀛︿範绗旇

    2017-12-11 17:19

  • 5个最顶级jQuery图表类库插件

    5个最顶级jQuery图表类库插件

    2017-12-11 11:00

网友点评
c