Develop your own one page scroll plug-in (1)
5. Features in other browsers
I often keep releasing the current version to get continuous feedback on GitHub. My development model is continuous iteration. At the beginning, I didn't pay too much attention to the effect of the mobile phone. In fact, I haven't paid much attention to this problem yet. But I actually used a simple solution. The init_scroll method can also be executed on the mobile phone by detecting and converting data. But this will not always achieve the effect, such as in the android browser. So I finally implemented a fallback to let the plug-in roll back to the local scrolling feature:
......
......
First, I define a variable to activate this fallback. The fallback content is the operation after the plug-in triggers fallback.
The code snippet above detects the browser width. If the width reaches a certain range, fallback is triggered, and then this method removes all display methods, turn the page into a normal sliding interface. This plug-in uses disabled-onepage-scroll to determine whether initialization has been performed. If not, it will be re-initialized.
This solution is not the best, but it can provide you with a solution. After all, it is not easy to solve one page scroll on your mobile phone.
6. cross-browser testing
Testing is a necessary part of the development process. When you release a plug-in, you must ensure that it can be successfully executed on most hosts. Chrome is my main browser and I often use it for development. If there is a browser you are familiar with, it will bring many benefits to your development, however, the disadvantage is that your perspective is limited and you cannot find many problems. For me, I will also test it in other browsers, including Firefox, Safari, and opera.
I mainly use my MacBook Air for development, but I also have computers with other operating systems in my home. I need to simulate all the environments of various users as much as possible. As we all know, ie is a big problem.
In addition, you should know that there are different browsers on mobile phones.
......
......
Read the full text: Develop your own one page scroll plug-in (2)
Develop your own one page scroll plug-in (2)