.fadeIn()을 사용하여 동적 콘텐츠 교체 모양을 좀 더 부드럽게 보이려고합니다. 내가 더블 페이드로만 설명 할 수있는 것을 얻는 것 외에는 (안팎으로).JQuery를 사용하여 double fadeIn
저는 JS와 jQuery API에 새로운 것이므로 어떤 도움을 주셨습니다.
데모 페이지 : http://robert-richter.com/boilerplate/
$('nav a').click(function(e) {
e.preventDefault()
var href = "inc/" + this.href.split('=').pop() + ".php"
$('.con').hide().load(href).fadeIn;
if (href == 'inc/blog.php') {
document.title = 'Robert-Richter.com | Blog';
window.location.hash = 'index.php?content=blog';
} else if (href == 'inc/portfolio.php') {
document.title = 'Robert-Richter.com | Portfolio';
window.location.hash = 'index.php?content=portfolio';
} else if (href == 'inc/lebenslauf.php') {
document.title = 'Robert-Richter.com | Lebenslauf';
window.location.hash = 'index.php?content=lebenslauf';
} else if (href == 'inc/kontakt.php') {
document.title = 'Robert-Richter.com | Kontakt';
window.location.hash = 'index.php?content=kontakt';
} else {
document.title = 'Robert-Richter.com';
window.location.hash = '';
}
return false;
});
는 또한하면 window.location.hash-것은 새 페이지가로드 될 때까지 다시 표시되지 않습니다,이 하나를 시도 domain/boilerplate/#index.php?content=blog
함수를 실행하지 않으면 함수에 액세스 할 수 없기 때문에 fadein이 없어야합니다. 그것은 두 번째 질문에 대해 예상되는 행동입니다. '$ ('. con '). hide() .load (href) .fadeIn();' – jcubic
. '#'는 "해쉬"라고 불리우며, 따라서'window.location.hash'는 URL에서 해시 다음에 나오는 문자열을 정의합니다. – cfs
모든 답변이 있습니다. Balint Bako의 솔루션이 효과가 있습니다. – AnaMaria