내 함수에 값이 있지만 정의되어 있지 않습니다.javascript/jquery에 매개 변수가있는 함수가 작동하지 않습니다.
<img onload="getFullnameDetails(263,225)" src="'+getBaseURL()+'js/check/no-image.png" rel="fullname" />
function getFullnameDetails(mainHeight,upperstyle){
setTimeout("fullnameCenter(mainHeight,upperstyle)",2000);
}
function fullnameCenter(mainHeight,upperstyle){
var distOfMainAndUpper = 38;
var mainHalfHeight = 131.5;
var imageHeight = jQuery("img[rel='fullname']").height(); //there is a delay
var imageHalfHeight = imageHeight/2;
var fromImageTopToMainHalf = mainHalfHeight - imageHeight;
var position = imageHalfHeight+fromImageTopToMainHalf-distOfMainAndUpper;
jQuery(".test1").css("bottom",position+"px");
}
그것은 mainHeight가 정의되어 있지 않은 것을 여기에 말한다 :
이
내 코드입니다. 왜 이런 일이 일어나는가? 이이 줄에서 발생 : 사전에setTimeout("fullnameCenter(mainHeight,upperstyle)",2000);
감사)
페냐, 고마워, 고마워! ;) – PinoyStackOverflower