开发者

Multiple mouseovers links changing a separate DIV Content

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.

Has anyone already done this or can guide me? I prefer jquery.

Thanks!


$("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!

Edit:

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>

I hope this is better!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜