2012-02-29 41 views
0

我有jcarousel設置滾動通過一堆圖像使用位於圖像上方的標準左和右箭頭。 我也想添加一組導航箭頭到圖像的底部,但需要給他們一個不同的類名,以便我可以設置他們的位置。 我需要在jcarousel javascript文件中編輯以添加這些額外的箭頭? 我想這可能是在這大塊的代碼...Jcarousel插件修改添加額外的導航控件

= this.list.wrap("<div></div>").parent(); 
if(this.container.size()===0)this.container=this.clip.wrap("<div></div>").parent();b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>'); 
this.buttonPrev=g(".jcarousel-prev",this.container); 
if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=g(this.options.buttonPrevHTML).appendTo(this.container); 
this.buttonPrev.addClass(this.className("jcarousel-prev")); 
this.buttonNext= g(".jcarousel-next",this.container); 
if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext=g(this.options.buttonNextHTML).appendTo(this.container); 
this.buttonNext.addClass(this.className("jcarousel-next")); 
this.clip.addClass(this.className("jcarousel-clip")).css({position:"relative"}); 
this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden",position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0); 
this.container.addClass(this.className("jcarousel-container")).css({position:"relative"}); 

回答

1

你可以做出頭的那樣:

$.mycarousel = function(e, o) { 
var $elfCarousel = $(e).jcarousel(o), 
$actionsContainer="<div class='other_actions'></div>"; 
$elfCarousel.wrap("<div></div>").append($actionsContainer); 
$actionsContainer.append("<div>bottom Next</div>").click(function(){ 
    $elfCarousel.find(".jcarousel-next").click(); 
}) 
$actionsContainer.append("<div>your other button here</div>").click(function(){/* your other action here*/}) 
$actionsContainer.append("<div>your last button here</div>").click(function(){/* your last action here*/}) 
} 

通過創建自己的插件包裝的jCarousel你會得到錯誤的jCarousel更正的好處。

+0

謝謝blobmaster。我沒有JavaScript技能,想知道在你說過的「你在這裏的其他動作」的部分是什麼意思? – user537137 2012-03-01 00:08:25

+0

如果你想廣告一個「去右邊或底部3張圖片你可以做:$ elfCarousel.find(」。jcarousel-prev「)。click()。click()。click();如果你看看jcarousel插件的代碼(http://sorgalla.com/projects/jcarousel/lib/jquery.jcarousel.js),你會看到其他可以調用的「綁定」 – blobmaster 2012-03-01 06:04:57

相關問題