zoukankan      html  css  js  c++  java
  • jquery--插件

    $.fn.myPlugin = function() {
        //在这里面,this指的是用jQuery选中的元素
        this.css('color', 'red');
        this.each(function() {
            //对每个元素进行操作
    这里的this指的是普通的dom元素
    $(this).append(' ' + $(this).attr('href')); })) }
    ;(function($){
    
        $.fn.tab = function(options){
            
            var defaults = {
                //各种参数,各种属性
            }
    
    
            var options = $.extend(defaults,options);
    
            this.each(function(){
                
                //各种功能  //可以理解成功能代码
                var _this = $(this);
                _this.find('.tab_nav>li').click(function(){
                    $(this).addClass('current').siblings().removeClass('current');
    
                    var index = $(this).index();
                    _this.find('.tab_content>div').eq(index).show().siblings().hide();
    
                });
    
    
            });
    
            return this;
        }
    
    
    
    })(jQuery);
    ; (function ($, window, document, undefined) {
    
        'use strict';
    
        var Tab = function (ele, opt) {
            this.$element = ele;
            this.default = {
    
            }
            this.option = $.extend({}, this.default, opt);
        }
        Tab.prototype = {
    
            tishi: function () {
                alert("提示");
            }
    
    
    
        }
    
        $.fn.tabMenu = function (options) {
            // var tab = new Tab(this, options)
            // return tab;
    
            return this.each(function (i, element) {
                var dom = $(element);
                dom.on("click", function () {
                    alert($(this).attr("style"));
                    alert('绑定点击事件');
                })
    
    
            });
    
            //return this;
        }
    
    })(jQuery, window, document);
  • 相关阅读:
    第二阶段个人冲刺总结01
    软件工程学习进度表13
    软件工程学习进度表12
    个人博客(09)
    个人博客(07)
    个人博客(08)
    poj1562 DFS入门
    poj3278 BFS入门
    数组单步运算
    十天冲刺
  • 原文地址:https://www.cnblogs.com/jentary/p/11759253.html
Copyright © 2011-2022 走看看