내 사이트의 링크를 클릭하면 주요 브라우저에서 작동하지만 IE9 이하는 작동하지 않습니다. 링크를 클릭하면 아무 일도 일어나지 않습니다! 콘솔에서 "event.returnValue가 사용되지 않습니다. 대신 표준 event.preventDefault()를 사용하십시오." 내가 IE9이 웹 사이트를 사용하고 작동 낮출 때 http://sudojesse.github.io/dynamic-page/index.htmlmodernizr이 IE9 이하에서 작동하지 않습니다.
를 (페이지를 새로 고침으로 만 작동한다!) :
나는이 웹 사이트에서이 방법을 사용하고 있습니다. 내가 뭘 잘못하고 있니?
편집 : 모든 것을 하위 폴더에 넣으면 작동합니다! 그것은 htacess와 함께 뭔가있을 수 있을까요?
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script type='text/javascript' src='js/modernizr.js'></script>
<script>$(function() {
if(Modernizr.history){
var newHash = "",
$mainContent = $("#main-content"),
$pageWrap = $("#page-wrap"),
baseHeight = 0,
$el;
$pageWrap.height($pageWrap.height());
baseHeight = $pageWrap.height() - $mainContent.height();
$("a").on("click", function() {
_link = $(this).attr("href");
history.pushState(null, null, _link);
loadContent(_link);
return false;
});
function loadContent(href){
$mainContent
.find("#guts")
.fadeOut(200, function() {
$mainContent.hide().load(href + " #guts", function() {
$mainContent.fadeIn(200, function() {
$pageWrap.animate({
height: baseHeight + $mainContent.height() + "px"
});
});
});
});
}
$(window).bind('popstate', function(){
_link = location.pathname.replace(/^.*[\\\/]/, ''); //get filename only
loadContent(_link);
});
} // otherwise, history is not supported, so nothing fancy here.
});</script>
IE9 이하 버전에서는 History API가 지원되지 않으므로 'Modernizr.history'는 false를 반환해야하며 스크립트는 실행되지 않습니다. – adeneo
어떻게 바꿀 수 있습니까? 왜 작동합니까? http://sudojesse.github.io/dynamic-page/index.html – user3086671
변경할 수 없습니다. API를 지원하지 않으면 API를 지원하지 않습니다. 일부 데모 페이지에서 작동하는 이유는 무엇입니까?하지만 Internet Explorer 9에서 작동하는 History API는 아니며 페이지를 다시로드하고 애니메이션을 속일 수 있습니다. IE9 이하에서는 – adeneo