2011-10-18 3 views
2

이후에 추가 된 요소를 표시 할 수 없습니다. 제품을 표시하는 페이지가 있으므로 일부 이미지와 데이터가로드되며 한 번에로드하면 크기가 커지므로 결정합니다. 아약스에 의한 IT 및 jQuery를에 의해 그것을 할이, 여기 내 코드입니다 : 내가 그것을 사용할 때

var static = 1; 
$('.carousel-next').live('click',function(){ 
$(this).attr("disabled", false); 
var pos_eq = static++; 
var url = 'ajax/ajax.php?count=' + pos_eq; 
if ($('.myList').children('li').length <= pos_eq) 
{ 
$.getJSON(url,function(data){ 
    if (data[0] != 404) 
    { 
$('.myList').append(data[0]); 
$('.myList').children('li').eq(pos_eq).children(".stagger").css({"left":"1200px"}); 
$('.myList').children('li').eq(pos_eq).children(".imac").css({"left":"1200px"}); 
$('.myList').children('li').eq(pos_eq).children(".stagger").animate({"left":"65px","effect":"slide"},500); 
$('.myList').children('li').eq(pos_eq).children(".imac").animate({"left":"350px","effect":"slide"},700); 
    } 
}); 
} 
else 
{ 
$('.myList').children('li').eq(pos_eq).children(".stagger").css({"left":"1200px"}); 
$('.myList').children('li').eq(pos_eq).children(".imac").css({"left":"1200px"}); 
$('.myList').children('li').eq(pos_eq).children(".stagger").animate({"left":"65px","effect":"slide"},500); 
$('.myList').children('li').eq(pos_eq).children(".imac").animate({"left":"350px","effect":"slide"},700); 
} 
}); 

$('.carousel-previous').live('click',function(){ 
$(this).attr("disabled", false); 
var pos_eq2 = static--; 
if (pos_eq2 < 0) 
pos_eq2 = 0; 
$('.myList').children('li').eq(pos_eq2).children(".stagger").css({"left":"-1200px"}); 
$('.myList').children('li').eq(pos_eq2).children(".imac").css({"left":"-1200px"});  $('.myList').children('li').eq(pos_eq2).children(".stagger").animate({"left":"65px","effect":"slide"},500); $('.myList').children('li').eq(pos_eq2).children(".imac").animate({"left":"350px","effect":"slide"},700); 
}); 

, 그것은 ajax.php 페이지에서 데이터를 얻을 페이지에 추가합니다 (I 그 일을 한 후 소스 코드를 보았다) 그러나 이제는 그들을 보여줄 것이고, 다음 부분은 페이지에 추가 한 후에 그 요소들을 보여 주어야하지만, 그렇게 할 수는 없습니다.

$('.myList').children('li').eq(pos_eq).children(".stagger").css({"left":"1200px"}); 
$('.myList').children('li').eq(pos_eq).children(".imac").css({"left":"1200px"}); 
$('.myList').children('li').eq(pos_eq).children(".stagger").animate({"left":"65px","effect":"slide"},500); 
$('.myList').children('li').eq(pos_eq).children(".imac").animate({"left":"350px","effect":"slide"},700); 

어디에 문제가 있습니까?

+0

'console.log (data [0])'을 수행하고 원하는 출력을 되찾고 있는지 확인하십시오. –

+0

확인을 위해 alert (data [0])를 사용하고 데이터를 가져옵니다. –

답변

0

Append()에는 작동 할 Dom 요소, HTML 문자열 또는 Jquery 개체가 필요합니다. 데이터에 문제가있을 수 있습니다. console.log (데이터)에서 어떤 결과를 얻을 수 있는지 보여 줄 수 있습니까?