\r\n\t\t
  • \"text/javascript\" src=\"@Url.AppendVersion(\"~/Content/Main/Tourism/js/jquery.roundabout.js\")\"
  • \r\n\t\t
  • \"text/javascript\" src=\"@Url.AppendVersion(\"~/Content/Main/Tourism/js/jquery.roundabout-shapes.js\")\"
  • \r\n\t\r\n\r\n

    主脚本 roundabout.js 
    \r\n副脚本 
    roundabout-shapes.js //包含各种预设好的效果

    \r\n

     

    \r\n

    2.Html

    \r\n
    \r\n\t
      \r\n\t\t
    1.  
    2. \r\n\t\t
    3. <div id=\"gla\"> 
    4. \r\n\t\t
    5.   <div id=\"gla_box\"> 
    6. \r\n\t\t
    7.     <div class=\"hd\"><ul>ul>div> 
    8. \r\n\t\t
    9.     <div class=\"bd\"> 
    10. \r\n\t\t
    11.         <span class=\"prev\"> span> 
    12. \r\n\t\t
    13.         <span class=\"next\"> span> 
    14. \r\n\t\t
    15.          <ul class=\"tList\"> 
    16. \r\n\t\t
    17.             @Power.ArticleList(\"文章头条列表\", new { Count = 5Node = \"lyjd\"TitleLength = 60TopicNum = 5,TopicTitleLength=60TopicContentLength=390Illustrated = trueSort=\"Priority,PublishTime,ContentId\"}) 
    18. \r\n\t\t
    19.         ul> 
    20. \r\n\t\t
    21.         <ul class=\"pList\"> 
    22. \r\n\t\t
    23.             @Power.ArticleList(\"文章图片列表\" , new { Count=5Node=\"lyjd\"TitleLength=0,ImageWidth=500ImageHeight=320Illustrated = trueSort=\"Priority,PublishTime,ContentId\"}) 
    24. \r\n\t\t
    25.          
    26. \r\n\t\t
    27.         ul> 
    28. \r\n\t\t
    29.     div> 
    30. \r\n\t\t
    31.   div> 
    32. \r\n\t\t
    33. div> 
    34. \r\n\t
    \r\n
    \r\n

    文章头条部份的展示并非脚本已经预留好的,需要自己进行同步和扩展。

    \r\n

    3.页面脚本

    \r\n
    \r\n\t
      \r\n\t\t
    1. \"text/javascript\"
    2. \r\n\t\t
    3. $(function(){ 
    4. \r\n\t\t
    5.     $('#gla_box .bd>ul.pList').roundabout({ 
    6. \r\n\t\t
    7.         minOpacity:1, 
    8. \r\n\t\t
    9.         btnNext: \".next\"
    10. \r\n\t\t
    11.         duration: 1000, 
    12. \r\n\t\t
    13.         reflect: true
    14. \r\n\t\t
    15.         btnPrev: '.prev'
    16. \r\n\t\t
    17.         autoplay:true
    18. \r\n\t\t
    19.         autoplayDuration:5000, 
    20. \r\n\t\t
    21.         tilt:0, 
    22. \r\n\t\t
    23.         shape: 'figure8'
    24. \r\n\t\t
    25.         btnNextCallback: function() { 
    26. \r\n\t\t
    27.             var index = $(\"#gla_box .pList\").find(\".roundabout-in-focus\").index(); 
    28. \r\n\t\t
    29.             $(\"#gla_box .tList li\").eq(index).addClass(\"on\").siblings().removeClass(\"on\"); 
    30. \r\n\t\t
    31.             }, 
    32. \r\n\t\t
    33.         autoplayCallback:function() { 
    34. \r\n\t\t
    35.             var index = $(\"#gla_box .pList\").find(\".roundabout-in-focus\").index(); 
    36. \r\n\t\t
    37.             $(\"#gla_box .tList li\").eq(index).addClass(\"on\").siblings().removeClass(\"on\"); 
    38. \r\n\t\t
    39.             }, 
    40. \r\n\t\t
    41.         btnPrevCallback: function() { 
    42. \r\n\t\t
    43.             var index = $(\"#gla_box .pList\").find(\".roundabout-in-focus\").index(); 
    44. \r\n\t\t
    45.             $(\"#gla_box .tList li\").eq(index).addClass(\"on\").siblings().removeClass(\"on\"); 
    46. \r\n\t\t
    47.             }, 
    48. \r\n\t\t
    49.         clickToFocusCallback: function() { 
    50. \r\n\t\t
    51.             var index = $(\"#gla_box .pList\").find(\".roundabout-in-focus\").index(); 
    52. \r\n\t\t
    53.             $(\"#gla_box .tList li\").eq(index).addClass(\"on\").siblings().removeClass(\"on\");
    54. \r\n\t\t
    55.             } 
    56. \r\n\t\t
    57.     }); 
    58. \r\n\t\t
    59. }); 
    60. \r\n\t\t
    61.  
    62. \r\n\t
    \r\n
    \r\n

    minOpacity  //最远物透明度
    \r\nmaxOpacity  //最近物透明度
    \r\nduration //过渡完成用时
    \r\nreflect //反转回旋处理方向

    \r\nautoplayDuration //设置自动播放下一个间隔时间
    \r\nshape //使用哪种过滤效果

    \r\n

    btnNextCallback //点击下一张时触发
    \r\nautoplayCallback  //自动播放下一张时触发
    \r\nbtnPrevCallback  //点击上一张时触发
    \r\nclickToFocusCallback  //点击图片时触发

    \r\n

    //因为这里需要和上面的头条同步,所以要同步一下选中效果,不需要可删除

    \r\n

    var index = $(\"#gla_box .pList\").find(\".roundabout-in-focus\").index(); 

    \r\n
    $(\"#gla_box .tList li\").eq(index).addClass(\"on\").siblings().removeClass(\"on\");
    \r\n

     

    \r\n

     

    \r\n

    4、部份预设效果

    \r\n

    figure8 

    \r\n

    \"\"

    \r\n

     

    \r\n

    waterWheel

    \r\n

    \"\"

    \r\n

     

    \r\n

    nowSlide

    \r\n

    \"\"

    \r\n

     

    \r\n

    risingEssence

    \r\n

    \"\"

    \r\n

     

    \r\n

    tearDrop

    \r\n

    \"\"

    \r\n

     

    \r\n

     

    \r\n

     

    \r\n

     

    \r\n", "copyrightHolder": "本站原创" }
    您的位置: 首页 >日志>前端技术>详细内容

    前端技术

    实用的滚动图片脚本库-Roundabout

    来源:本站原创 发布时间:2017-06-28 10:15:34 浏览次数: 【字体:

     

    这类图片层滚动效果其实网上脚本很多,但很多过渡都做得不够好。国外普遍用  featureCarousel 或 Roundabout 这两个JQ插件实现。

    featureCarousel 这是比较早,也一直在用,Roundabout 出得比较晚,了解下,发现功能、效果和扩展都比featureCarousel 好。

     

    1.引入插件

    1. "text/javascript" src="@Url.AppendVersion("~/Content/Main/Tourism/js/jquery-1.7.2.min.js")"
    2. "text/javascript" src="@Url.AppendVersion("~/Content/Main/Tourism/js/jquery.roundabout.js")"
    3. "text/javascript" src="@Url.AppendVersion("~/Content/Main/Tourism/js/jquery.roundabout-shapes.js")"

    主脚本 roundabout.js 
    副脚本 
    roundabout-shapes.js //包含各种预设好的效果

     

    2.Html

    1.  
    2. <div id="gla"> 
    3.   <div id="gla_box"> 
    4.     <div class="hd"><ul>ul>div> 
    5.     <div class="bd"> 
    6.         <span class="prev"> span> 
    7.         <span class="next"> span> 
    8.          <ul class="tList"> 
    9.             @Power.ArticleList("文章头条列表", new { Count = 5Node = "lyjd"TitleLength = 60TopicNum = 5,TopicTitleLength=60TopicContentLength=390Illustrated = trueSort="Priority,PublishTime,ContentId"}) 
    10.         ul> 
    11.         <ul class="pList"> 
    12.             @Power.ArticleList("文章图片列表" , new { Count=5Node="lyjd"TitleLength=0,ImageWidth=500ImageHeight=320Illustrated = trueSort="Priority,PublishTime,ContentId"}) 
    13.          
    14.         ul> 
    15.     div> 
    16.   div> 
    17. div> 

    文章头条部份的展示并非脚本已经预留好的,需要自己进行同步和扩展。

    3.页面脚本

    1. "text/javascript"
    2. $(function(){ 
    3.     $('#gla_box .bd>ul.pList').roundabout({ 
    4.         minOpacity:1, 
    5.         btnNext: ".next"
    6.         duration: 1000, 
    7.         reflect: true
    8.         btnPrev: '.prev'
    9.         autoplay:true
    10.         autoplayDuration:5000, 
    11.         tilt:0, 
    12.         shape: 'figure8'
    13.         btnNextCallback: function() { 
    14.             var index = $("#gla_box .pList").find(".roundabout-in-focus").index(); 
    15.             $("#gla_box .tList li").eq(index).addClass("on").siblings().removeClass("on"); 
    16.             }, 
    17.         autoplayCallback:function() { 
    18.             var index = $("#gla_box .pList").find(".roundabout-in-focus").index(); 
    19.             $("#gla_box .tList li").eq(index).addClass("on").siblings().removeClass("on"); 
    20.             }, 
    21.         btnPrevCallback: function() { 
    22.             var index = $("#gla_box .pList").find(".roundabout-in-focus").index(); 
    23.             $("#gla_box .tList li").eq(index).addClass("on").siblings().removeClass("on"); 
    24.             }, 
    25.         clickToFocusCallback: function() { 
    26.             var index = $("#gla_box .pList").find(".roundabout-in-focus").index(); 
    27.             $("#gla_box .tList li").eq(index).addClass("on").siblings().removeClass("on");
    28.             } 
    29.     }); 
    30. }); 
    31.  

    minOpacity  //最远物透明度
    maxOpacity  //最近物透明度
    duration //过渡完成用时
    reflect //反转回旋处理方向

    autoplayDuration //设置自动播放下一个间隔时间
    shape //使用哪种过滤效果

    btnNextCallback //点击下一张时触发
    autoplayCallback  //自动播放下一张时触发
    btnPrevCallback  //点击上一张时触发
    clickToFocusCallback  //点击图片时触发

    //因为这里需要和上面的头条同步,所以要同步一下选中效果,不需要可删除

    var index = $("#gla_box .pList").find(".roundabout-in-focus").index(); 

    $("#gla_box .tList li").eq(index).addClass("on").siblings().removeClass("on");

     

     

    4、部份预设效果

    figure8 

     

    waterWheel

     

    nowSlide

     

    risingEssence

     

    tearDrop