/*
* jqpressToos1.0
*
* Copyright (c) 2011 yepeng
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
*/
$.fn.extend({
//Plug-in name: Tab
jqpressTab: function(options) {
//Parameters and default values
var defaults = {
_tabClass: null,//tab style
_childs:null //child option style selector
};
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 < parentCate.length; i ) {
if (parentCate[i] .className == o._tabClass) {
childCate[i].style.display = "block";
} else {
childCate[i].style.display = "none";
}
}
});
}
});
})(jQuery);
Calling the method is simpler:
jQuery(document).ready(function(){ $ (".mytab li a").jqpressTab({ _tabClass: "Style name", _childs: "Child element style name" });});
If you need to make your own selector based on ID Go ahead and expand it, haha