【问题标题】:Multiple mouseovers links changing a separate DIV Content多个鼠标悬停链接更改单独的 DIV 内容
【发布时间】:2010-10-13 06:43:16
【问题描述】:

我有五个链接要更改同一个单独 DIV 中的内容。每个链接对应不同的内容。在鼠标离开时,我需要在单独的 DIV 中返回默认文本。

有没有人已经这样做或可以指导我?我更喜欢 jquery。

谢谢!

【问题讨论】:

    标签: mouseover


    【解决方案1】:
    $("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>
    

    我希望这会更好!

    【讨论】:

    • 这是我的链接:www.feedmyorphan.com 看看底部的链接。我希望中心文本随着页脚左右所有链接的变化而变化,并用 mouseleave 恢复其默认值。
    猜你喜欢
    • 1970-01-01
    • 2014-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-30
    • 2015-03-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多