web299.com
全部
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
首页
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
当前位置:
首页
>
网页特效
>
导航菜单
jQuery和css3多级手风琴插件
分类:
导航菜单
日期:
2024-05-14
点击(1)
评论(0)
演 示
免费下载
简介
这是一个简单的jQuery和css3手风琴效果。效果上类似于目录结构。 ##### HTML ```html
Oat cake tootsie roll
Donut pastry
Carrot cake
Donut pastry
Tootsie roll marshmallow
``` ##### JAVASCRIPT ```html ;( function( $, window, undefined ) { 'use strict'; // global var $body = $( 'html, body' ); $.CBPNTAccordion = function( options, element ) { this.$el = $( element ); this._init( options ); }; // the options $.CBPNTAccordion.defaults = {}; $.CBPNTAccordion.prototype = { _init : function( options ) { // options this.options = $.extend( true, {}, $.CBPNTAccordion.defaults, options ); // cache some elements and initialize some variables this._config(); // initialize/bind the events this._initEvents(); }, _config : function() { // the clickable items this.$items = this.$el.find( '.cbp-nttrigger' ); }, _initEvents : function() { this.$items.on( 'click.cbpNTAccordion', function() { var $listItem = $( this ).parent(); if( $listItem.hasClass( 'cbp-ntopen' ) ) { $listItem.removeClass( 'cbp-ntopen' ); } else { $listItem.addClass( 'cbp-ntopen' ); $body.scrollTop( $listItem.offset().top ); } } ); }, destroy : function() { this.$items.off( '.cbpNTAccordion' ).parent().removeClass( 'cbp-ntopen' ); } }; var logError = function( message ) { if ( window.console ) { window.console.error( message ); } }; $.fn.cbpNTAccordion = function( options ) { if ( typeof options === 'string' ) { var args = Array.prototype.slice.call( arguments, 1 ); this.each(function() { var instance = $.data( this, 'cbpNTAccordion' ); if ( !instance ) { logError( "cannot call methods on cbpNTAccordion prior to initialization; " + "attempted to call method '" + options + "'" ); return; } if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) { logError( "no such method '" + options + "' for cbpNTAccordion instance" ); return; } instance[ options ].apply( instance, args ); }); } else { this.each(function() { var instance = $.data( this, 'cbpNTAccordion' ); if ( instance ) { instance._init(); } else { instance = $.data( this, 'cbpNTAccordion', new $.CBPNTAccordion( options, this ) ); } }); } return this; }; } )( jQuery, window ); ```
相关推荐
html5浪漫粒子表白文字特效
SlidesJS幻灯片特效
html5瀑布流相册特效
css3 svg实现的情人节表白鲜花动画特效
t-scroll.js基于ES6的DOM元素,过渡动画库插件
纯js写省市区三级联动效果
广告
广告