( iOS 浏览器)难道真的没办法在滚动时运行 JS 吗? - V2EX
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
shuding
V2EX    iDev

( iOS 浏览器)难道真的没办法在滚动时运行 JS 吗?

 
  •   shuding
    shuding Dec 25, 2014 7014 views
    This topic created in 4158 days ago, the information mentioned may be changed or developed.

    setTimeoutsetIntervalonscrollrequestAnimationFrame 都试过了……
    均会在惯性滚动的时候被暂停 _(:з」∠)_
    真的没有好的解决办法么 0 0?

    以及,scrolling end 是不是也不能监听到?

    10 replies    2015-05-11 18:59:08 +08:00
    bumz
        1
    bumz  
       Dec 25, 2014   1
    有一法,那就是禁用掉 iOS 自的,自己模仿一。 https://bumfo.github.io/overflow.html 外的好是可以毛玻璃效果~ https://workspace.v2ex.com/file/c64143a0-8ba7-11e4-9d18-42010af0ecaa/2849178970-5463896a48365.jpeg
    bumz
        2
    bumz  
       Dec 25, 2014   1
    等等,了一下,你信 scrolling 的候是法行 js,不是法更新 scroll layer dom?

    我,requestAnimationFrame,js 一直好好地行呢 (iOS 8 Safari),而且更新 scroll layer 是 fixed layer 都(iOS7 好像只能更新 fixed layer)。
    shuding
        3
    shuding  
    OP
       Dec 25, 2014
    @bumz 谢谢!你的 demo 实在太棒了!

    我的测试是 iOS 7 > <,scrolling 确实会暂停。

    搜到一些资料,(iOS 7 里边)确实是 Apple 暂停掉了。
    看来是 iOS 8 有改变: http://developer.telerik.com/featured/scroll-event-change-ios-8-big-deal/
    yyfearth
        4
    yyfearth  
       Dec 25, 2014
    说是js会执行 但是不paint
    hkongm
        5
    hkongm  
       Dec 25, 2014
    IOS8的SAFARI才有了真正的scroll事件。
    alexrezit
        6
    alexrezit  
       Dec 25, 2014
    @shuding
    iOS 8 更新的容之一.
    shuding
        7
    shuding  
    OP
       Dec 25, 2014
    @hkongm @alexrezit 谢谢(所以大概是因为我还在用 7,才没发现这一点吧……QAQ
    iyangyuan
        8
    iyangyuan  
       Dec 25, 2014
    好像滚动的时候,css animation也会停掉。。。
    whatisnew
        9
    whatisnew  
       May 11, 2015
    现在有好的解决方案了吗?快速滑动的时候,animation 就废了。。。
    @bumz
    bumz
        10
    bumz  
       May 11, 2015 via iPad
    @whatisnew iOS 8 一切正常,iOS 7 除了自外,不可能有比完美的解方案。

    不 fixed 和 sticky 的元素在可以被 js 更新,然 css 被停,但是也可以用 js 操。。。

    demo: https://bumfo.github.io/anim.html

    iOS 7 下,保持手指移,
    然而如果手指有移,目前也有什法能了。
    About     Help     Advertise     Blog     API     FAQ     Solana     5818 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 50ms UTC 01:55 PVG 09:55 LAX 18:55 JFK 21:55
    Do have faith in what you're doing.
    script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-11940834-2', 'v2ex.com'); ga('send', 'pageview'); ga('send', 'event', 'Node', 'topic', 'idev'); ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86