当底层图像滑开时隐藏滑块中的标题文本#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 »</a></span></p>
<img src="<?= $latestItem->picture ?>" alt="<?=$latestItem->title ?>" title="<?=$latestItem->title ?>" />
</li>
任何人都可以帮我弄清楚如何让标题与相应的图像一起消失吗?
I'm not too familiar with mootools but i'm implementing an image slider on which i want to add some captions. So far that works but when the image slides away, the captions remain... If the next image slides on with the new caption, the caption slides over the previous one... This is the piece of code where the image gets hidden and where i think i could hide the captions as well...
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 »</a></span></p>
<img src="<?= $latestItem->picture ?>" alt="<?=$latestItem->title ?>" title="<?=$latestItem->title ?>" />
</li>
Can anyone help me figure out how i can manage to let the captions dissapear together with the corresponding image?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的标记中,标题是紧邻图像之前的
标记,因此回调中的
el.getPrevious()
将引用该标记 - 尽您所能:)ps尝试更好地格式化你的问题
in your markup, the caption is a
<p>
tag immediately before the image soel.getPrevious()
in your callback will reference that- do your worst :)p.s. try to format your questions a little better