zoukankan      html  css  js  c++  java
  • JQ效果:随便看看

    $(function($){
        $.fn.changeList = function(options){
            var defaults = {
                        tag : 'li', // tab name
                        subName : '.utilTabSub', // sub class name
                        eventType : 'click', // event type
                        num : 4,
                        showType : 'show' // show effect type
                    },
                    opts = $.extend({}, defaults, options),
                    that = $(this),
                    subUl = that.find(opts.subName),
                    subItems = subUl.find('li'),
                    size = subItems.length,
                    liW = subItems.outerWidth(true),
                    ulW = liW * size,
                    page = size + 1,
                    n = opts.num,
                    randNum = 0,
                    m = 0;

            if(size > n){
                that.find(opts.tag)[opts.eventType](function() {
                    randNum = mathRand(n, size);
                    subItems.hide();
                    $.each(randNum, function (i, el) {
                        subItems.eq(el).fadeIn(800);
                    });
                });
            }
        };
    }(jQuery));

    /**
     * create Random number
     * @param bit: number
     * @param max: max number
     * @return {Array}
     
    */
    function mathRand(bit, max){
        var num = 0,
                arr = [],
                ret = [];
        for(var i=0; i<bit; i++){
            num = Math.floor(Math.random() * max);
            if($.inArray(num, ret) == -1){
                ret.push(num);
            } else {
                i--;
                continue;
            }
        }
        return ret;
    }

  • 相关阅读:
    vs2015连接oracle 11g(.net自带方式 using System.Data.OracleClient;)
    div层叠顺序额
    linux运维、架构之路-Zabbix自动化
    linux运维、架构之路-Zabbix监控
    linux运维、架构之路-keepalived高可用
    linux运维、架构之路-内网NTP时间服务器
    linux运维、架构之路-Nginx反向代理
    linux运维、架构之路-数据库迁移
    linux运维、架构之路-网络基础
    linux运维、架构之路-shell编程(一)
  • 原文地址:https://www.cnblogs.com/jikey/p/2831691.html
Copyright © 2011-2022 走看看