안녕하십니까.이 스크립트를 수정하기 위해 2 일 동안 노력했습니다. 링크가 id = "paginations"(물론 내가 newb이기 때문에 실패했을 때마다) 호출 할 수 있습니다.).콘텐츠를 Jquery (Paginate)로 변경하십시오.
정확하게 무엇을하려하는지이 링크가 #content 안에있는 경우에도 #content를로드하고 변경하려면이 함수를 호출해야합니다. 이렇게
<div class="pagination">
<a href="test.php">clik2</a>
</div>
나는 함수를 만들어 온 클릭으로 전화를 시도했지만 난 실패했습니다. 이 스크립트는 링크가 #Content 외부에 있으면 완벽하게 작동하지만 #Content 내부에서도 작동해야합니다. 어떤 아이디어라도 제발?
$ 난 당신이 뭘 하려는지 생각 (문서) .ready (함수() {링크가 자바 스크립트로 추가되는 경우
var hash = window.location.hash.substr(1);
var href = $('.pagination a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html #content';
$('#content').load(toLoad)
}
});
$('.pagination a').click(function(){
var toLoad = $(this).attr('href')+' #content';
$('#content').hide('1000',loadContent);
$('#load').remove();
$('#wrapper').append('<span id="load"></span>');
$('#load').fadeIn('slow');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').delay(100).show('fast',hideLoader());
$(window).scrollTop('');
}
function hideLoader() {
$('#load').delay(300).fadeOut('fast');
}
return false;
});
});
.live 메서드는 jQuery 1.7에서 더 이상 사용되지 않습니다. jQuery 1.7 이상인 경우 이벤트 위임에 .on 메서드를 사용해야합니다. http://api.jquery.com/on/ – alexp
많은 사람들이 매력적으로 작용했기 때문에 다른 사람이이 작업을 도와 줄 수 있기를 바랍니다. 1 amaizing script –