为什么会一直报not defined呢
start: { left: event.pageX, top: event.pageY - 50 }, end: { left: offset.left + 10, top: offset.top + 10, width: 0, height: 0 },
这个例子在窗口滚动时可能会不正确。解决方式如下:
flyer.fly({ start: { left: event.pageX, top: event.pageY - $(document).scrollTop() }, end: { left: offset.left + 10, top: offset.top - $(document).scrollTop() + 10, width: 0, height: 0 } });
function show_tip() { var flyer = $('.goods-pic > img').clone().css({ 'z-index': '999', 'height': '3rem', 'width': '3rem' }); flyer.fly({ start: { left: $('.goods-pic > img').offset().left, top: $('.goods-pic > img').offset().top - $(window).scrollTop() }, end: { left: $("#cart_count1").offset().left + 5, top: $("#cart_count1").offset().top - $(window).scrollTop(), width: 0, height: 0 }, onEnd: function() { flyer.remove(); } }); }