当前位置:网站首页>2022 opening H5 mobile page special effects
2022 opening H5 mobile page special effects
2022-06-23 02:49:00 【Tanguangjian】
In the twinkling of an eye ,2022 Has come quietly ; Because I have been busy with the iteration and... Of a medium-sized project recently AR The launch of the project , Have been N I haven't published any technical articles for a long time ; The last one was last year Iot Introduction to the development of the development board sent by the students . Let's talk about it today H5 Special effects of mobile page ; all 2022 Return year H5? Can't H5 It's so popular , In particular, wechat has opened the external connection H5 It's important again . So let's talk about the recent development H5 Some of the experience .
1、 Mobile phone horizontal and vertical judgment
Mobile phones are the first in the world , Now mobile phones are basically 70% The carrier of ( The rest of the pad Slightly ); One problem is that the length, width and height of the vertical and horizontal screens are different , It will have an important impact on the overall page layout .
Here is how to automatically determine whether the screen is horizontal or vertical :
if ( window.orientation == 180 || window.orientation==0 ) {
alert(" Vertical screen ");
} else if( window.orientation == 90 || window.orientation == -90 ) {
alert(" Horizontal screen ");
}This is to enter the page for judgment , If you can judge whether the mobile phone is vertical or horizontal after entering it ? Of course it can , Go straight to the code :
window.addEventListener('orientationchange', function(event) {
if ( window.orientation == 180 || window.orientation==0 ) {
alert(" Vertical screen ");
} else if( window.orientation == 90 || window.orientation == -90 ) {
alert(" Horizontal screen ");
}
});2、 Turn to the whole page
Judge whether it is horizontal or vertical , Sometimes it can be handled by different layouts , But it takes a lot of energy , Because it needs to be done. 2 Set layout ; So I came up with a function to flip through the mirror image , Of course, I haven't applied this function yet . I used it anyway 2 Set layout processing .. tired . Here is the code for image flipping , It's simple, just in CSS Add in .
body {
-webkit-transform: rotate(90deg);
}So the whole page will turn clockwise 90°.. What's the role ? Existence is reason , It will be used in the future .
3、 Gravity induction of mobile phone and application of gyroscope
Now I can H5 Most of them are smart phones , Generally, it is equipped with gravity induction and gyroscope ; What about this 2 What's the use of one ? It can sense the angle and speed of the mobile phone . for instance : Shaking is actually used here 2 The data of two . This has an open source component Parallax.JS【http://matthew.wagerfield.com/parallax/】 I will not explain here , If you are interested, you can leave a message or go to see it yourself , I've also used this , I feel it is easy to start and realize ..
Let's say one last thing , Small H5 Apply directly to jq or jq mobile... Good maintenance ; Of course it's popular now VUE It's OK , But the feeling vue A little wide .. See what people think .
边栏推荐
- Small knowledge points of asset
- Applet control version update best practices
- February 1, 2022: painting house II. If there is a row of houses, N in total, each
- Reading redis source code (VI) multi threading of redis 6.0
- Source code analysis | activity setcontentview I don't flash
- Tencent cloud server CVM system tool configuration
- PNAs: power spectrum shows obvious bold resting state time process in white matter
- Unity official case nightmare shooter development summary < I > realization of the role's attack function
- How to customize a finished label template
- Operate attribute chestnut through reflection
猜你喜欢

My good brother gave me a difficult problem: retry mechanism

8. greed

Third order magic cube formula

Evolution history of mobile communication

Performance testing -- Interpretation and practice of 16 enterprise level project framework

6. template for integer and real number dichotomy

Soft exam information system project manager_ Information system comprehensive testing and management - Senior Information System Project Manager of soft test 027

5g core network and core network evolution

WebService details

Microservice Optimization: internal communication of microservices using grpc
随机推荐
[SaaS examination certification] apaas_ Tencent Qianfan magic pen
February 2, 2022: the closest binary search tree value II. Given a non empty two
Microservice Optimization: internal communication of microservices using grpc
DNS Service Setup
[data preparation and Feature Engineering] perceived data
Buuctf misc-[bjdctf2020] Nani
Reading redis source code (III) initialization and event cycle
Qingdao stadium has made headlines again, but it has nothing to do with sports
Supervisor multi process management exception automatic restart visual management
Performance test -- Jenkins environment construction for 15jmeter performance test
Deep analysis of time complexity
Record a penetration caused by log4j
Detailed explanation of online reputation management
Nfv and SDN
January 31, 2022: Maze III. There is a ball in the maze of open spaces and walls. ball
Weekly Postgres world news 2022w04
Troubleshooting and solution of 4K video cannot be played on easydss live video on demand platform
3. install and deploy Mgr cluster | explain Mgr in simple terms
Goframe framework (RK boot): Based on cloud native environment, distinguish configuration files (config)
Calling applet demo modifying the default large screen view