【发布时间】:2010-10-13 06:43:16
【问题描述】:
我有五个链接要更改同一个单独 DIV 中的内容。每个链接对应不同的内容。在鼠标离开时,我需要在单独的 DIV 中返回默认文本。
有没有人已经这样做或可以指导我?我更喜欢 jquery。
谢谢!
【问题讨论】:
标签: mouseover
我有五个链接要更改同一个单独 DIV 中的内容。每个链接对应不同的内容。在鼠标离开时,我需要在单独的 DIV 中返回默认文本。
有没有人已经这样做或可以指导我?我更喜欢 jquery。
谢谢!
【问题讨论】:
标签: mouseover
$("a.link").mouseleave(function() {
$("#sepdiv").text($(this).text());
});
//share the same class ("link" as an example) with all your links. and have an id for the separate div
你的问题不清楚,我没有任何可以作为基础的代码,但我希望这就是你要找的。让我知道,以便我编辑我的答案!
编辑:
查看评论中分享的网站后:
js
$(document).ready(function() {
//this is your code - just add it all under one document load
$.preloadCssImages();
$('#slider').nivoSlider();
$('a.share-links').hover(function() {
$('#ms').text($(this).text());
}, function() {
$('#ms').text(function() {
return $(this).attr("title");
});
});
});
css
.share-links
{
text-indent:-9999px;
}
html
<div id="ms" title="Our crusade to feed every orphan in the world.">
Our crusade to feed every orphan in the world.
</div>
<div id="nc_wrap2">
<a class="nc1 share-links" href="#">Facebook</a>
<a class="nc2 share-links" href="#">Twitter</a>
<a class="nc3 share-links" href="#">..</a>
<a class="nc4 share-links" href="#">..</a>
<a class="nc5 share-links" href="#">..</a>
</div>
我希望这会更好!
【讨论】: