2010-05-25 105 views
0
window.addEvent( 'domready中',函數(){ VAR totIncrement = 0的卷軸; 變種增量= 560; 變種maxRightIncrement =增量*( - 6); VAR FX =新Fx.Style( '滑塊列表', '保證金左',{ 持續時間:1000, 過渡:Fx.Transitions.Back.easeInOut, 等待:真 }); // - ----------------------------------- // EVENT for the button「previous」 $('previous ').addEvents({'click':function(event){ if(totIncrementmaxRightIncrement){totlcrement = totIncrement-increment; fx.stop() fx.start(totIncrement); } } }) }); 在mootools的V1.1

設置焦點上時按鈕被點擊

它使一個滾動條功能,在我的HTML頁面的底部。 但是當我點擊下一個按鈕頁面的焦點移動到頁面的頂部。我如何將它保存在滾動條上?

這是HTML片段:

<h3>Our Pastas</h3> 

<div id="slider-buttons"> 
<a href="#" id="previous">Previous</a> | <a href="#" id="next">Next</a&gt; 
</div> 

<div id="slider-stage"> 
<ul id="slider-list"> 

<li class="list_item"> 

<div id="thumbnail"><a href="xxx/product-catalog/pasta/long-pasta-in-brown-bags/bucatini"><img src="xxx/images/stories/products/_thumb1/bucatini.gif"></a></div><h4><a href="xxx/product-catalog/pasta/long-pasta-in-brown-bags/bucatini">Rustichella d'Abruzzo Bucatini</a></h4> 
</li> 


<li class="list_item"> 
<div id="thumbnail"><a href="xxx/product-catalog/pasta/pasta-in-trays/calamarata"><img src="xxx/images/stories/products/_thumb1/calamarata.jpg"></a></div><h4><a href="xxx/product-catalog/pasta/pasta-in-trays/calamarata">Rustichella d'Abruzzo Calamarata</a></h4> 
</li> 


<li class="list_item"> 
<div id="thumbnail"><a href="xxx/product-catalog/pasta/pasta-in-trays/cannolicchi"><img src="xxx/images/stories/products/_thumb1/cannolicchi.jpg"></a></div><h4><a href="xxx/product-catalog/pasta/pasta-in-trays/cannolicchi">Rustichella d'Abruzzo Cannolicchi</a></h4> 
</li> 


</ul></div> 

回答

2

這是MooTools的1.11,MOD你的下一個和以前的功能,像這樣:

$('next').addEvents({ 
     'click' : function(event){ 
     // add this to stop the default click event. 
     new Event(event).stop(); 

     // continue as usual. 
     if(totIncrement>maxRightIncrement){ 
      totIncrement = totIncrement-increment; 
      fx.stop() 
      fx.start(totIncrement); 
     } 
     }    
    }); 
在mootools的

1.2+,你需要的是event.stop();event.preventDefault();