【问题标题】:Clear main image in gallery on mouseout of thumbnail?鼠标移出缩略图时清除画廊中的主图像?
【发布时间】:2015-06-05 18:21:45
【问题描述】:

我正在使用此处找到的脚本:

Automatically load an image using javascript

我正在使用它们构建图像库,其中主图像在mouseenter 上加载缩略图图像,但我的主图像开始空白,而不是答案中的第一个缩略图。我需要知道如何将每个缩略图的mouseout 上的主图像清除回空白?

【问题讨论】:

    标签: javascript image gallery


    【解决方案1】:

    像这样尝试 JQuery .mouseout()

    $('.thumbnails img').mouseout(function () {
        this.src = '';
    });
    

    单击http://jsfiddle.net/cnx65ev0/ 以查看它正在运行。将鼠标悬停在图像上,当您离开它们时,它们将变为空白。我希望这是你想要的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-04-25
      • 1970-01-01
      • 1970-01-01
      • 2013-04-20
      • 1970-01-01
      • 1970-01-01
      • 2019-05-05
      相关资源
      最近更新 更多