zoukankan      html  css  js  c++  java
  • jquery插件开发

    (function($){
    $.fn.yourName = function(options){
    //各种属性、参数

    var defaults = {    

        foreground: 'red',    

        background: 'yellow'    

      };    


    }
    var options = $.extend(defaults, options);
    this.each(function(){
    //插件实现代码
    });
    };
    })(jQuery); 

    http://www.jb51.net/article/22849.htm

    完整:

    (function($){
    $.fn.tableUI = function(options){
    var defaults = {
    evenRowClass:"evenRow",
    oddRowClass:"oddRow",
    activeRowClass:"activeRow"
    }
    var options = $.extend(defaults, options);
    this.each(function(){
    var thisTable=$(this);
    //添加奇偶行颜色
    $(thisTable).find("tr:even").addClass(options.evenRowClass);
    $(thisTable).find("tr:odd").addClass(options.oddRowClass);
    //添加活动行颜色
    $(thisTable).find("tr").bind("mouseover",function(){
    $(this).addClass(options.activeRowClass);
    });
    $(thisTable).find("tr").bind("mouseout",function(){
    $(this).removeClass(options.activeRowClass);
    });
    });
    };
    })(jQuery);



    <script type="text/javascript" language="javascript" src="js/jquery.tableui.js"></script>
      <script type="text/javascript">
      $().ready(function(){
      $(".table_solid").tableUI();
      })
      </script>
  • 相关阅读:
    JavaScript 面向对象
    javascript中this的指向
    销售
    Java垃圾回收机制
    判断浏览器是否缩放
    pattern space and hold space of sed
    语言基础
    Python中PyQuery库的使用总结
    多个计数器在Vuex中的状态
    Sklearn
  • 原文地址:https://www.cnblogs.com/zhangweixin/p/4318346.html
Copyright © 2011-2022 走看看