나는 다음과 같은 코드를 가지고있다. 조금 길어서 opts
을 무시하면, 그것도 없이도 작동하지만, 아무 일도 일어나지 않기 때문에 내가 잘못하고있는 것처럼 보인다. 그것을 할 생각 이죠jQuery Plugin | 왜이 부분이 작동하지 않습니까?
var container = 'body';
var structureWrapper = '<div class="content-login"></div>';
var structure = [
'<form name="', opts.formClass, '" class="', opts.formClass, '" method="post" action="#">',
'<fieldset class="', opts.fieldsWrapper, '">',
'<fieldset class="', opts.userWrapper, '">',
'<label for="', opts.userInt, '" class="', opts.userLbl, '"><img src="', opts.userIcon, '" alt="', opts.userName, '" /></label>',
'<input type="text" name="', opts.userInt, '" class="', opts.userInt, '" placeholder="', checkNameLenght(opts.userName, namesLenght.userNameLenght, 16, 'Username'), '" value="" autocomplete="off" />',
'</fieldset>',
'<fieldset class="', opts.passWrapper, '">',
'<label for="', opts.passInt, '" class="', opts.passLbl, '"><img src="', opts.passIcon, '" alt="', opts.passName, '" /></label>',
'<input type="password" name="', opts.passInt, '" class="', opts.passInt, '" placeholder="', checkNameLenght(opts.passName, namesLenght.passNameLenght, 16, 'Password'), '" value="" autocomplete="off" />',
'</fieldset>',
'<fieldset class="', opts.btnWrapper, '">',
'<button type="submit" name="', opts.btnInt, '" class="', opts.btnInt, '">', checkNameLenght(opts.btnName, namesLenght.btnNameLenght, 7, 'Login'), '</button>',
'</fieldset>',
'</fieldset>',
'<div class="toogle-button">',
'<ul class="inside">',
'<li class="toogle"><a><img src="assets/gfx/toogle.png" alt="Back" /></a></li>',
'</ul>',
'</div>',
'</form>',
'<div class="toogle-buttons">',
'</div>'
];
var getProps = function(obj) {
return {
'position': 'absolute',
'top': (($(window).height() - $(obj).outerHeight())/2) + 'px',
'left': (($(window).width() - $(obj).outerWidth())/2) + 'px'
}
}
var showObj = function(obj, callback) {
return setTimeout(function() {
if (opts.centerObj === true) {
var cssProps = getProps(obj);
obj.css(cssProps).fadeIn('slow');
}
else {
obj.fadeIn('slow');
}
if (typeof callback == 'function') {
callback.call(this);
}
}, 1500);
}
var appendStructure = function(wrapper, structure, cls) {
return $(wrapper).appendTo(container).hide(function() {
var obj = $(container).find(cls);
$(structure.join('')).appendTo(obj);
showObj(obj, function() {
if (opts.centerObj === true) {
$(window).resize(function() {
var cssProps = getProps(obj);
obj.css(cssProps);
});
}
});
});
}
appendStructure(structureWrapper, structure, '.content-login');
는 해당 배열을 가지고 그것을 연결하고 내 경우, 컨테이너에 body
그것을 추가, 다음의 내용을 페이드입니다. 당신은 내가 잘못 아무것도 발견 할 수 있습니까?
도와 주셔서 감사합니다. :) 여기에 도우미가 있습니다. http://jsfiddle.net/VUjMH/.
와의 인스턴스를 교체, 내가 친절하게하자 당신은 "길이"가 "길이"로 잘못 표기되어 있음을 압니다. –
이전에 언급 했었지만 코드에 영향을주지는 않습니다. 정의한 'var'입니다. – Roland
'opts'를 어떻게 무시할 수 있습니까? 우리를 위해 그것을 정의하지 않고 그것을 사용하고 있습니다, 그래서 이것을 어떻게 디버그 할 수 있습니까? – voithos