1
我在我的項目中使用這個庫:jQuery Tools Tabs,從我讀過的,我可以使我的自定義效果,而不是默認的。jQuery工具選項卡自定義動畫
我決定有這樣一個效果:Demo。我發現了一些可能類似的東西,但我在實施時遇到了麻煩。
$.tools.tabs.addEffect("subFade", function(tabIndex, done) {
var conf = this.getConf(),
speed = conf.fadeOutSpeed,
panes = this.getPanes();
var $tab = this.getCurrentTab();
if($tab.hasClass("current")){//Going AWAY from the tab, do hide animation (before the tab is hidden)
$(".tabs-tab").animate({"left" : "0px"}, 300, function(){//I was sliding it behind the tabs when not in use, replace with your own animation
panes.hide();
panes.eq(tabIndex).fadeIn(200, done);
console.log("Done done");
//This is then end of the chain - my animation, hide all then fade in new tab.
});
} else {//going away from any other tab
panes.hide();
panes.eq(tabIndex).fadeIn(200, done);
}
$tab = this.getTabs().eq(tabIndex);
if($tab.hasClass("current")){//Going to my special tab.
$(".tabs-tab").animate({"left" : "-160px"}, 300);//Sliding it out
}
// the supplied callback must be called after the effect has finished its job
done.call();
});
以上是我一直在嘗試,但沒有成功。所以我想知道如果有人知道我做錯了什麼,我怎麼能讓自定義效果像演示一樣?
謝謝,但我有種依靠jQuery的工具來處理,我的意思是,這就是爲什麼有可能有一個自定義效果(:所以有沒有什麼解決方法可以在jQuery工具選項卡中實現這一點? – Roland
我從來沒有使用過jQuery工具,所以很遺憾我不能幫你。對不起:男人:( –
沒問題(:我實際上可以使用你的一些方法我自定義的插件效果(: – Roland