开发者

Workaround for history animation in Safari for OS X Lion?

开发者 https://www.devze.com 2023-03-21 15:50 出处:网络
In Safari for OS X Lion, when you use the swipe gesture to navigate forward or backward in history, the window animates as though you were moving through physical pages.The problem with this behavior

In Safari for OS X Lion, when you use the swipe gesture to navigate forward or backward in history, the window animates as though you were moving through physical pages. The problem with this behavior is that many apps already listen for changes in the history state, and respond appropriately -- either when the hash is changed, or when HTML5 pushState is used.

A perfect example is GitHub, when navigating in and out of folders -- https://github.com/johndyer/mediaelement, for example. If you click on a folder, then swipe to the previous page, the end state "snapshot" is shown, and then animated to again 开发者_运维百科from the beginning state, which not only is confusing, but nullifies the informational value of the animation.

Today is my first day using Lion, but I'm curious if any other web devs have encountered this issue, and whether you've found a workaround?


Sadly it seems there's no documentation about this in the Safari Developer Library.

But there is an (ugly) workaround to disable them on your client machine at least. In the Trackpad settings, if you set Swipe between pages to Swipe with two or three fingers you can use two fingers to do fancy animations, and three fingers if you don't like them. But it feels really weird, especially because the three finger swipe is in the wrong direction.


Maybe use Modernizr to sniff out Safari and rely on Safari's native animation instead of your code's animation? I know this doesn't help with consistency, but lets face it... this is a browser we are talking about!


I would suggest that you go into settings and navigate to gestures. Here, you will see a little dropdown bar that contains the options. Select either of the other two options to fix this. Hope I could help!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号