多个鼠标悬停链接可更改单独的DIV内容 [英] Multiple mouseovers links changing a separate DIV Content
本文介绍了多个鼠标悬停链接可更改单独的DIV内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有五个链接,我想在同一单独的DIV中更改内容.每个链接对应不同的内容.在mouseleave上,我需要默认文本才能在单独的DIV中返回.
I have five links that I want to change the content in the same separate DIV. There's different content corresponding to each link. On the mouseleave, I need the default text to return inside the separate DIV.
有人已经这样做或可以指导我吗?我更喜欢jquery.
Has anyone already done this or can guide me? I prefer jquery.
谢谢!
推荐答案
$("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
您的问题尚不清楚,我没有任何可作为基础的代码,但我希望这是您要查找的内容.让我知道,以便我可以编辑答案!
You question isn't clear and I don't have any code that I can base this on but I hope this is what you where looking for. let me know so I can edit my answer!
查看评论中共享的网站后:
After looking at the website shared in the comment:
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>
我希望这会更好!
这篇关于多个鼠标悬停链接可更改单独的DIV内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文