$("#photoAlbum").on("mouseenter", ".imagecontainer", function () {
$(this).find('.controlbar').show("slide", { direction: "down" }, 1000);
}).on("mouseleave", ".imagecontainer", function () {
$(this).find('.controlbar').hide("slide", { direction: "up" }, 1000);
});
.controlbar
默认隐藏
.imagecontainer
div(s)附加到#photoAlbum div之后
一个ajax请求因此我使用.on()
而不仅仅是.hover(function() {}, function(){})
HTML,drop-backdrop绝对定位。
<div id="photoAlbum" class="tabcontent">
<div id="drop-backdrop">
<div class="text">Drag files here to upload</div>
</div>
<canvas id="drop-target"></canvas>
<div class="imagecontainer"><div class="controlbar" style="visibility: hidden; "><img src="/TreeView/images/delete.png" width="16px" height="16px"></div><img src="/Content/photoAlbums/9/3/539695_t.jpg"></div></div>
答案 0 :(得分:0)
如果您希望脚本正常工作,则应加载jQuery UI库
或使用:
$("#photoAlbum").on("mouseenter", ".imagecontainer", function () {
$(this).find('.controlbar').slideDown(1000);
}).on("mouseleave", ".imagecontainer", function () {
$(this).find('.controlbar').slideUp(1000);
});
而不是style="visibility: hidden; "
使用style="display:none; "