HTML5/CSS3 implements adding lock screen effect_html/css_WEB-ITnose
锁屏效果,也就是将屏幕置于模态,不允许用户触发任何动作,只能解除锁定后才能继续使用,jQueryUI的dialog有模态对话框,这一点不难做到。那么,首先需要在页面中添加一个div层,用于做模态的层:
Html代码
其对应的CSS比较简单,主要设置一下z-index属性,值设置的很大即可,就能达到覆盖其余元素的效果,加上opacity淡化一下背景:
Css代码
- #overlay{
- height:100%;
- min-width:1280px;
- width:100%;
- position:absolute;
- left:0px;
- top:0px;
- opacity:0.7;
- z-index:100;
- }
这样就有了一个覆盖页面之上的层,显示效果为:
下面是添加解除锁定的部分,我们模仿iphone解锁效果,那么需要添加一下:
Html代码
-
- 滑动解除锁定
A rounded rectangular box with a button image on the left, giving a prompt message, it is not difficult:
Css code
- #slide{
- position:absolute;
- top:75%;
- width:52%;
- left:24%;
- height:86px;
- border-radius:18px;
- border:1px solid #2F368F;
- border- bottom:1px groovy #2F368F;
- z-index:101;
- background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #2F368F ),color-stop(1, #77D1F6));
- opacity:0.9;
- }
The z-index set here is larger than The modal layer is large so that we can control it. There is not much to say.
Css code
- #slider{
- float:left;
- position:relative;
- cursor:pointer;
- height:44px;
- background: url(../images/arrow.png) no-repeat;
- border- radius:16px;
- margin:-5px;
- text-align:center;
- width: 146px; }
- Images are used in the slider, so the effect is better. The width of the rectangular frame is consistent with the slider image setting, and margins can be fine-tuned on their own. The following is the key text area. The effect used here is currently only supported by the webkit kernel, which means that FF does not support this effect for the time being.
Css code- height:50px;
- width:70%;
- float:left;
- padding-top:14px;
- font-family:"Microsoft Yahei";
- font-size:44px;
- font-weight:100;
- text-align:center;
- vertical-align: middle;
- background: -webkit-gradient(linear ,left top,right top,color-stop(0, #4d4d4d),color-stop(0.4, #4d4d4d),color-stop(0.5, white),color-stop(0.6, #4d4d4d),color-stop( 1, #4d4d4d));
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- -webkit-animation: slidetounlock 5s infinite; 🎜>
- Css code
- @-webkit-keyframes slidetounlock {
- 0% {background-position: -200px 0;}
}
The final effect we simulated is:
The dynamic highlighting part of the text in the picture is the part that other kernels do not support for the time being. In this way, our effect is completed. At this time, it is all static. Nothing can be done, we use jqueryUI's draggable to add dynamic effects:
Js code
- $(function() {
- var slideWidth=$("#slide").width();
- $("#slider").draggable({
- axis: 'x',
- containment: 'parent',
- drag: function(event, ui) {
- if (ui.position.left > slideWidth*0.7) {
- // do nothing
- }
- },
- stop: function(event, ui) {
- if (ui.position.left
- $(this).animate({left: 0});
- }
- }
- }); 🎜> } );
- We dynamically obtain the set slide width, then apply the draggable method, set the horizontal drag, and when the drag distance reaches 70% of the rectangle length, the modal layer and the slide The block disappears and is restored to the page. Then we have completed adding the lock screen effect to the page.
- Finally, the source code is attached, I hope it will be useful to users.
- backend.rar (151.8 KB)

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to design the dotted line segmentation effect in the menu? When designing menus, it is usually not difficult to align left and right between the dish name and price, but how about the dotted line or point in the middle...


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool