gpt4 book ai didi

Firefox 4 中的 jQuery

转载 作者:行者123 更新时间:2023-12-03 22:53:14 26 4
gpt4 key购买 nike

这段代码一直工作正常,直到我转到 Firefox 4,现在它需要在同一张图像上单击两次才能调整大小才能工作?有什么想法吗?这是代码。

    $(document).ready(function(){

$("#slideShow a").click(function() {
var imgTitle = $(this).children('img').attr('title'); // Find the image title
$("#thecap").html(' ' + imgTitle + ' ');
$("#lgImage").attr('src', $(this).children('img').attr('rel'));
$( ".resizeme1" ).aeImageResize({ height: 372 });
});

});

这是插件代码,以防有人看到其中的内容?

(function( $ ) {



$.fn.aeImageResize = function( params ) {

var aspectRatio = 0
// Nasty I know but it's done only once, so not too bad I guess
// Alternate suggestions welcome :)
, isIE6 = $.browser.msie && (6 == ~~ $.browser.version)
;

// We cannot do much unless we have one of these
if ( !params.height && !params.width ) {
return this;
}

// Calculate aspect ratio now, if possible
if ( params.height && params.width ) {
aspectRatio = params.width / params.height;
}

// Attach handler to load
// Handler is executed just once per element
// Load event required for Webkit browsers
return this.one( "load", function() {

// Remove all attributes and CSS rules
this.removeAttribute( "height" );
this.removeAttribute( "width" );
this.style.height = this.style.width = "";

var imgHeight = this.height
, imgWidth = this.width
, imgAspectRatio = imgWidth / imgHeight
, bxHeight = params.height
, bxWidth = params.width
, bxAspectRatio = aspectRatio;

// Work the magic!
// If one parameter is missing, we just force calculate it
if ( !bxAspectRatio ) {
if ( bxHeight ) {
bxAspectRatio = imgAspectRatio + 1;
} else {
bxAspectRatio = imgAspectRatio - 1;
}
}

// Only resize the images that need resizing
if ( (bxHeight && imgHeight > bxHeight) || (bxWidth && imgWidth > bxWidth) ) {

if ( imgAspectRatio > bxAspectRatio ) {
bxHeight = ~~ ( imgHeight / imgWidth * bxWidth );
} else {
bxWidth = ~~ ( imgWidth / imgHeight * bxHeight );
}

this.height = bxHeight;
this.width = bxWidth;
}
})
.each(function() {

// Trigger load event (for Gecko and MSIE)
if ( this.complete || isIE6 ) {
$( this ).trigger( "load" );
}
});
};
})( jQuery );

最佳答案

请尝试FireQuery (与 Firebug 一起使用),也许这个工具可以帮助您找出问题所在。

关于Firefox 4 中的 jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5583381/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com