Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the effect of digital page turning with transform in JavaScript

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to achieve digital page turning effect in transform in JavaScript". In daily operation, I believe that many people have doubts about how to achieve digital page turning effect in JavaScript. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for everyone to answer the doubt of "how to achieve digital page turning effect in JavaScript". Next, please follow the editor to study!

Effect picture:

Figure (1) initial diagram

Figure (2) the process of turning pages

Figure (3) result of turning the page

The code is as follows:

Transition # container {width:500px; height:500px; margin:20px auto; background:#ff0000;-webkit-transiton:background 2s linear,width 2s department height 2s;-moz-transition:background 2s magistral width 2s department height 2s;-o-transition:background 2s magistral width 2s department height 2s;-ms-transition:background 2s recital width 2s department height 2s; transition:background 2s force width 2s department height 2s;} # container:hover {background:# 00ff00misswidthplace200px height;} # my3dspace {- webkit-perspective:800 -webkit-perspective-origin:50% 50%; overflow: hidden;} # pagegroup {width: 400px; height: 400px; margin: 0 auto;-webkit-transform-style:preserve-3d; position: relative;} .page {width: 360px; height: 360px; padding: 20px; background-color: black; color: white; font-size: 360px; font-weight: blod; line-height: 360px; text-align: center; position: absolute;} # page1 {- webkit-transform-origin:top; transform-origin:top -webkit-transition:-webkit-transform 1s linear; transition:transform 1s linear;} # page2,#page3,#page4,#page5,#page6 {- webkit-transform-origin:top; transform-origin:top;-webkit-transition:-webkit-transform 1s linear; transition:transform 1s linear;-webkit-transform:rotateX (- 90deg); transform:rotateX (- 90deg);} # op {text-align: center; margin: 40px auto;} 1 2 3 4 5 6 next prev var curIndex = 1 Function next () {if (curIndex==6) return; var curPage = document.getElementById ("page" + curIndex); curPage.style.webkitTransform= "rotateX (90deg)"; curPage.style.transform = "rotateX (90deg)"; curIndex + +; var nextPage = document.getElementById ("page" + curIndex); nextPage.style.webkitTransform= "rotateX (0deg)"; nextPage.style.transform= "rotateX (0deg)";} function prev () {if (curIndex==1) return; var curPage = document.getElementById ("page" + curIndex); curPage.style.webkitTransform= "rotateX (- 90deg)" CurPage.style.transform= "rotateX (- 90deg)"; curIndex--; var prevPage = document.getElementById ("page" + curIndex); prevPage.style.webkitTransform= "rotateX (0deg)"; prevPage.style.transform= "rotateX (0deg)";} at this point, the study on "how to achieve the effect of digital page flipping in JavaScript" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report