Javascript 如何在图像标签jQuery中显示图像

Javascript 如何在图像标签jQuery中显示图像,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我想在每个图像标记后附加一个图像以显示共享按钮。这是fiddler链接 $document.readyfunction{ $img.eachfunction{ 如果$this.prop'height'>100&$this.prop'width'>100{ $this.addClass myClass; $this.wrapInner; } }; }; .myclass:悬停{ 不透明度:0.7; } 见下面的输出 使用after函数在该特定项之后插入 $document.readyfunct

我想在每个图像标记后附加一个图像以显示共享按钮。这是fiddler链接

$document.readyfunction{ $img.eachfunction{ 如果$this.prop'height'>100&$this.prop'width'>100{ $this.addClass myClass; $this.wrapInner; } }; }; .myclass:悬停{ 不透明度:0.7; } 见下面的输出

使用after函数在该特定项之后插入

$document.readyfunction{ $img.eachfunction{ 如果$this.prop'height'>100&$this.prop'width'>100{ $this.addClass myClass; $this.after; } $'.myClass'.hover函数{ $this.next.show; },功能{ $this.next.hide; }; }; }; .myclass:悬停{ 不透明度:0.7; } 使用此代码:

$(document).ready(function() {
    $("img").each(function() {
        if($(this).prop('height')>100 && $(this).prop('width')>100)
        {
            $(this).addClass( "myClass" );
            $('<img src="https://cdn3.iconfinder.com/data/icons/iconic-1/32/share-128.png" />').insertAfter($(this));
        }

    });
});

你好,先生。非常感谢您的回答,但仍然面临css问题新fid链接jsfiddle.net/q98up2f3/3@user1837779你在这个链接中有什么问题?悬停时,其他图像的css没有改变ie显示:无显示:block@user1837779如果它像你想要的那样工作,那么编辑原始问题。它不会随着css而改变,因为它需要是它的父项元素以在父元素悬停时更改子元素的css