[英]Jquery Image zoom not working properly in Opera
我從StackOverflow獲得了以下代碼:
$(document).ready(function() {
$(function(){
$('img').load(function() {
$(this).data('height', this.height);
}).bind('mouseenter mouseleave', function(e) {
$(this).stop().animate({
height: $(this).data('height') *
(e.type === 'mouseenter' ? 1.5 : 1)
});
});
});
});
它可以在IE,Chrome,Firefox和Opera中運行。 但是在Opera中,它只有在我第一次進入頁面時才起作用(如果我在地址欄中輸入鏈接)。 我有一個4頁的網站,當我從另一個頁面轉到Jquery頁面時,鼠標懸停時不會縮放圖片。
$(function(){
$('img').each(function() {
$(this).data('height', this.height);
}).on('mouseenter mouseleave', function(e) {
$(this).stop().animate({
height: $(this).data('height') * (e.type === 'mouseenter' ? 1.5 : 1)
});
});
});
順便說一句: $(document).ready(function() {
等於$(function() {
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.