我想要一個圖像出現在我的div當一個鏈接懸停。我得到了圖像出現,但它出現在我的容器外面...有人可以看到我的代碼有什麼問題嗎?我附加到我的div的圖像位於我的div的外側
<div class = "container-fluid categories">
<div class = "row">
<div class = "col-sm-12 text-center links">
<a class = "nav-all" href = "">
All
</a>
<a class = "nav-nature" href = "">
Nature
</a>
<a class = "nav-building" href = "">
Buildings & Street Life
</a>
<a class = "nav-fashion" href = "">
Fashion
</a>
<a class = "nav-food" href = "">
Food
</a>
<a class = "nav-abstract" href = "">
Abstract
</a>
<a class = "nav-covers" href = "">
Artist Covers
</a>
</div>
</div>
</div>
.categories {
height: 400px;
width: 100%;
border: 1px solid white;}
function imageHover() {
$(".nav-all").mouseenter(function(){
$('<img src = "cover.jpg" width = "100%" height = "100%" /img>').hide().appendTo(".categories").fadeIn("slow");
});
$(".nav-all").mouseleave(function(){
$("img").remove();
});
}
你能爲我們提供一個小提琴嗎? – Swellar
@Swellar您需要的所有東西都在提供的代碼中。 jQuery中的HTML無效。 – Rob
@Rob我看到了,那麼我想它是 – Swellar