2012-09-02 38 views
0

我用一個jQuery平滑滾動的效果,沒有什麼fancy..just jQuery的工作...,它似乎並沒有工作在iPad或iPhone或任何其他tablets..the網址是在這裏:http://teothemes.com/wp/viewpoint/jQuery的平滑滾動不會對iPad和iPhone

,這是我用於jquery的平滑滾動的代碼:

jQuery(document).ready(function() { 
jQuery("a[href*=#]").on('click', function() { 
    if(parseInt(jQuery(this.hash).offset().top) !== parseInt(jQuery(window).scrollTop())) 
    jQuery('html,body').animate({scrollTop:jQuery(this.hash).offset().top}, 1500); 
}); 

});

如果有人有任何想法,它是高度讚賞。

+0

你好,你有沒有找到一個解決這個? – JasonDavis

回答

0

你試過了CSS Property -webkit-overflow-scrolling:touch ;?

0

我讀過這是一個iOS 6.1的問題,它似乎並沒有固定在iOS 7的最早版本中。不是真的有一個簡單的解決方案,所以作爲解決方法,我是當檢測到iPhone和iPod時使用Gentle Anchors,如果我發現我需要其他設備,則會更新此帖子。

$('html, body').stop().animate({ 
     'scrollTop': $target.offset().top }, 1000); 
    if(/iPhone|iPod/i.test(navigator.userAgent)) { 
     Gentle_Anchors.Setup(target); 
     //for iPhone & iPod 
    } 

不幸的是我看到有些結巴,除非我告訴頁是否已經檢測到這些設備中的一個來設置視口等於<head> iPhone的縱向寬度。

0

$(document).ready(function() { 
 

 
    $('.nav-wrapper ul li a').click(function(e) { 
 
    $('html,body').animate({ scrollTop: jQuery(this.hash).offset().top-134}, 500); 
 
});