0
다른 HTML 문서의 내용을 div #content에로드하려면 ajax를 사용합니다. 그러면 url이 mydomain/index.html # user1이됩니다. 각 "사용자"html 문서에는 jquery cycle 슬라이드 쇼가 있습니다. 사용자 페이지를 독립적으로 보면 (아약스를 통해로드되지 않음) 슬라이드 쇼가 정상적으로 작동합니다. 인덱스 페이지에서 ajax를 통해로드 된 사용자 페이지를 보면 슬라이드 쇼가 작동하지 않습니다. 내가로드 페이지에서 싸이클을 호출하려고했습니다해시가있는 ajax가로드 된 페이지의 jquery 사이클
<script type="text/javascript">
$(document).ready(function() {
// slideshow
$('#slideshow').cycle({
fx: 'fade',
prev: '#prev',
next: '#next',
timeout: 0
});
// Check for hash value in URL
var hash = window.location.hash.substr(1);
var href = $('.thumbgroup div a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html #content';
$('#content').load(toLoad)
}
});
// project-links
$('.thumbgroup div a').click(function(){
var toLoad = $(this).attr('href')+' #content';
$('#content').hide('fast',loadContent);
$('#load').remove();
$('#header').append('<span id="load">LOADING...</span>');
$('#load').fadeIn('normal');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').show('normal',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('normal');
}
return false;
});
});
</script>
그것은 여전히 작동하지 않습니다
내가 여기에 인덱스에서 JQuery와 사이클 호출 내가 상단에있는 것입니다. 누구든지이 초보자를위한 아이디어가 있다면 나는 매우 감사 할 것입니다! 감사!