Safari(Mac OSのみ、Windowsは正常に動作します)で奇妙な問題が発生しています。スムーズなスクロールがスクロールしません。リンクにジャンプするだけですが、Windows Safariでも、他のすべてのブラウザで機能します。
私のjQueryは
<script type="text/javascript">
(function($){
$.extend({
smoothAnchors : function(speed, easing, redirect){
speed = speed || "slow";
easing = easing || null;
redirect = (redirect === true || redirect == null) ? true : false;
$("a").each(function(i){
var url = $(this).attr("href");
if(url){
if(url.indexOf("#") != -1 && url.indexOf("#") == 0){
var aParts = url.split("#",2);
var anchor = $("a[name='"+aParts[1]+"']");
if(anchor){
$(this).click(function(){
if($(document).height()-anchor.offset().top >= $(window).height()
|| anchor.offset().top > $(window).height()
|| $(document).width()-anchor.offset().left >= $(window).width()
|| anchor.offset().left > $(window).width()){
$('html, body').animate({
scrollTop: anchor.offset().top,
scrollLeft: anchor.offset().left
}, speed, easing, function(){
if(redirect){
window.location = url
}
});
}
return false;
});
}
}
}
});
}
});
})(jQuery);
</script>
私のHTMLは次のようになります
<nav id="nav">
<ul id="navigation">
<li><a href="#About" class="fade"> ABOUT</a></li>
<a name="About"></a>
誰かが問題を知っているなら、私に知らせてください!
とても有難い。