2012-06-29 80 views
0

我還有一個問題,在我的網站上我已經分層橫向導航。它很好用,但現在我修改了它。Magento只顯示x個屬性,之後顯示更多選項

對於某些產品類別有例如。將出現在categorielevel上的12個屬性,但我只想顯示5個屬性,之後您將不得不點擊顯示更多選項。

我已經建立了一個斷線,規定只有5個屬性會顯示,所以只剩下顯示更多的選項。

回答

0

我認爲最簡單的方法是將這些附加鏈接放在單獨的<div />或其他元素中,並將其設置爲display: none;樣式。然後,我會使用一個簡單的JavaScript代碼在點擊Show more鏈接(例如,


<a href="javascript:void(0)" id="show-more-link">Show more</a> 
&ltdiv style="display:none;" id="other-attributes">(the content)</div> 
<script type="text/javascript"> 
//use prototype for this matter 
$('show-more-link').observe('click', function(){ 
    if ($('other-attributes')).visible() { //hide 
    $('other-attributes').hide(); 
    this.update('Show more'); 
    } else { 
    $('other-attributes').show(); 
    this.update('Show less'); 
    } 
    return false; 
}); 
</script> 

我還沒有測試過,但我認爲像這樣的東西應該工作。