欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery 簡單圖片導(dǎo)航插件jquery.imgNav.js

 更新時間:2010年03月17日 20:12:35   作者:  
前幾天某MM要偶幫忙實(shí)現(xiàn)栗子汀首頁的圖片導(dǎo)航效果,很簡單而且具有通用性的一個需求,點(diǎn)圖片A切換圖片A相關(guān)的內(nèi)容,點(diǎn)圖片B切換圖片B相關(guān)的內(nèi)容,僅此而已。

熟悉jquery的家伙大概花個5到10分鐘就可以搞定了吧。由于這種導(dǎo) 航效果比較通用,LEVIN順手寫了個 jquery插件~

如果你的網(wǎng)站也需要類似的效果,大可拿去直接用或者擴(kuò)展下:)

如果你也想嘗試將某些可重用功能封 裝成jquery插件,別忘了看看一般的jquery插件開發(fā)過程,另外還有偶的一個jquery插件模板。

復(fù)制代碼 代碼如下:

;(function($) {
// Private functions.
var p = {};
p.showC = function(opts) {
///<summary>show content of a specified navigation</summary>
p._clist.hide().filter(opts.filter).show();
}; //showNav
p.onNav = function(evt) {
p._i=$(this);
p._alist.removeClass(p._opts.on);
p._i.addClass(p._opts.on);
p.showC({ filter:p._i.attr("href") });
return false;
}; //onClick
//main plugin body
$.fn.imgNav = function(options) {
// Set the options.
options = $.extend({}, $.fn.imgNav.defaults, options);
p._opts = options;
// Go through the matched elements and return the jQuery object.
return this.each(function() {
p._alist = $("a", this);
p._clist = $(p._opts.navc);
p._alist.click(p.onNav);
});
};
// Public defaults.
$.fn.imgNav.defaults = {
on: 'on',
off: 'off',
navc: '.navc'//nav content selector
};
})(jQuery);

相關(guān)文章

最新評論