2011-05-02 49 views
0

我對mootools不太熟悉,但是我正在實現一個圖像滑塊,在該圖像滑塊上我想添加一些標題。到目前爲止,這種方式很有效,但當圖像滑落時,標題仍然存在......如果下一張圖像滑過新標題,標題會滑過前一個圖像......這是圖像隱藏的一段代碼,其中,我想我可以隱藏標題,以及...在底層圖像滑動時隱藏滑塊中的標題文本#mootools

initialize: function(menu, images, loader, options){ 
this.parent(menu, options); 
this.images = $(images); 
this.imagesitems = this.images.getChildren().fade('hide'); 
$(loader).fade('in'); 
new Asset.images(this.images.getElements('img').map(function(el) { return el.setStyle('display', 'none').get('src'); }), { onComplete: function() { 
    this.loaded = true;  
    $(loader).fade('out'); 
    if (this.current) this.show(this.items.indexOf(this.current)); 
    else if (this.options.auto && this.options.autostart) this.progress(); 
}.bind(this) }); 
if ($type(this.options.transition) != 'function') this.options.transition = $lambda(this.options.transition); 
}, 

//And here is the HTML (and PHP-Codeigniter): 

<li class="relative"> 
<p class="slogan"><span class="highlight"><?=$latestItem->slogan?><br/><a href="#">Lees meer &raquo;</a></span></p> 
<img src="<?= $latestItem->picture ?>" alt="<?=$latestItem->title ?>" title="<?=$latestItem->title ?>" /> 
</li> 

誰能幫我找出我怎麼能設法讓字幕與相應的圖像一起dissapear?

回答

0
var foo = new Class({ 
    initialize: function(menu, images, loader, options) { 
     this.parent(menu, options); 
     this.images = $(images); 
     this.imagesitems = this.images.getChildren().fade('hide'); 
     $(loader).fade('in'); 
     new Asset.images(this.images.getElements('img').map(function(el) { 
      el.getPevious().setStyle("display", "none"); 
      return el.setStyle('display', 'none').get('src'); 
     }), { 
      onComplete: function() { 
       this.loaded = true; 
       $(loader).fade('out'); 
       if (this.current) this.show(this.items.indexOf(this.current)); 
       else if (this.options.auto && this.options.autostart) this.progress(); 
      }.bind(this) 
     }); 
     if ($type(this.options.transition) != 'function') this.options.transition = $lambda(this.options.transition); 
    } 
}); 
在您的標記

,標題是<p>標籤立即在回調圖像,這樣el.getPrevious()之前將引用但─做你最可怕的:)

附:嘗試更好地格式化您的問題

+0

感謝您的回覆...我現在要看看它! 對不起,這些問題的格式不好,將來會試着想一想! 再次感謝! – Rypens 2011-05-03 17:46:02

+0

剛剛注意到您的代碼中存在一個小錯字(只是爲了讓您知道) - Pevious。修正了這個問題,然後滑塊完全隱藏了標題,而不是與相應的圖像一起顯示......我會盡力解決這個問題。我會盡快給您回覆! – Rypens 2011-05-03 17:58:28

+0

在執行以下操作時: 'new Asset.images(this.images.getElements('img')。map(function(el){} {} {} {} return el.setStyle('display','none')。get('src'); }),' 標題隱藏完全隱藏...我也嘗試返回el.getPrevious行,但也與沒有運氣......任何其他想法:)? – Rypens 2011-05-03 18:16:58