マウスが div .test の上にあるときは、div .box を .test の上にスライドさせたいと思います。
正常に動作していますが、.test の左上でマウスを動かしていると動作しないようです。理由はわかりません...
私のcssは:
.box{
z-index:2;
position: absolute;
}
そして私のjQuery:
box = function(el) {
$('body').append('<div class="box"></div>');
var box = $('.box:last');
var posTop = el.offset().top;
var posLeft = el.offset().left;
box.hide().css({
'left': posLeft,
'top': posTop
}).html('azerty<br>azerty<br>azerty<br>azerty<br>azerty<br>azerty<br>azerty').slideToggle(150);
}
boxStop = function() {
var box = $('.box:last');
box.stop().slideToggle(150, function() {box.remove();});
}
$(document).on('mouseover', '.test', function() {
box($(this));
}).on('mouseout', function() {
boxStop();
});