/*
* jqpresstoos1.0
*
* copyright (c) 2011 yepeng
* dual licensed under the mit (mit-license.txt)
* and gpl (gpl-license.txt) licenses.
*
*/
$.fn.extend({
//插件名称:tab选项卡
jqpresstab: function(options) {
//参数和默认值
var defaults = {
_tabclass: null,//选项卡样式
_childs:null //子选项 样式选择器
};
var options = $.extend(defaults, options);
var o = options;
var parentcate = $(this);
var childcate = $(o._childs);
parentcate.mouseover(function() {
parentcate.removeclass(o._tabclass);
$(this).addclass(o._tabclass);
for (i = 0; i if (parentcate[i].classname == o._tabclass) {
childcate[i].style.display = block;
} else {
childcate[i].style.display = none;
}
}
});
}
});
})(jquery);
调用方法更简单:
复制代码 代码如下:
jquery(document).ready(function(){ $(.mytab li a).jqpresstab({ _tabclass: 样式名称, _childs: 子元素样式名称 });});
如果需要根据id做选择器自己扩展去吧,呵呵
