zoukankan      html  css  js  c++  java
  • 新闻滚动

    //新闻滚动
    (function($) {
      $.fn.myScroll = function(options) {
        var opts = $.extend(true, {},
        $.fn.myScroll.defaults, options);
        return this.each(function() {
            var $this = $(this);
            var $li=$this.find("li"),
                li_len=$li.length,
                li_height=$li.outerHeight(),
                page_li_len=Math.floor($this.height()/li_height),
                page=Math.ceil(li_len/page_li_len),
                scrollHeight=li_height*(page_li_len),
                li_width=$li.width(),
                index=0;
            var slideFunc=function(){
                if(index>=page){index=0;}else if(index<=-1){index=page-1;}
                console.log(index);
                $this.find("ul").animate({marginTop:-index*scrollHeight});
                };
            $this.find(".prev").on("click",function(){
                index=index-1;
                slideFunc();
            });
            $this.find(".next").on("click",function(){
                index=index+1;
                slideFunc();
            });
        });
      };
      $.fn.myScroll.defaults = {
      };
    })(jQuery);
  • 相关阅读:
    Ceph
    linux五天光速入门
    shell编程
    Docker&K8S&持续集成与容器管理--系列教程
    openstack系列
    爬虫快速入门
    python奇闻杂技
    机器学习
    数据分析
    量化分析
  • 原文地址:https://www.cnblogs.com/dingyuanxin/p/4120297.html
Copyright © 2011-2022 走看看