"Turn" CSS3 realize iOS7 "frosted glass" blur effect

Source: Internet
Author: User

-webkit-filter

This property is the main property of this feature that we implemented this time

This attribute is still in the draft stage, only Chrome +, Safari browser support, but believe that over time, will soon be large-scale application.

Specific filter usage I will write another article to share with you, here is mainly about its blur (), brightness (), contrast () 3 properties.

Blur ()

Used to set the degree of ambiguity of the corresponding DOM, the usage is simple

filter: blur(5px)
Brightness ()

Used to set the brightness of the corresponding DOM, the larger the corresponding value is brighter

filter: brightness(0.5)
Contrast ()

The larger the contrast value, the stronger

filter: contrast(200%)
Clip:rect (205px 572px 516px 351px);

Used to cut the DOM, equivalent to the concept of masking, because the CSS blur will cause the edge to become very light, affecting our effect, so we use the cut to subtract its edge, so that looks good.

clip: rect(205px 572px 516px 351px); 

# # #实例
Html:
<Divclass= "iOS7">        <Divclass= "Ios7_f">            <imgsrc= "Ios7_icon_redesign_by_ida_swarczewskaja.jpg"width= "700px"Height= "525px" />        </Div>        <Divclass= "Ios7_b">            <imgsrc= "Ios7_icon_redesign_by_ida_swarczewskaja.jpg"width= "700px"Height= "525px" />        </Div>        <Divclass= "Ios7_i">            <imgsrc= "Control-center-btns.png"width= "222px"Height= "331px"/>        </Div></Div>

Css:

. iOS7{width:700px;Height:525px;Overflow:Hidden;position:relative;margin:0 Auto; }. Ios7_f,. Ios7_b{position:Absolute;Top:0; Left:0;}. Ios7_f img,. ios7_b img{width:700px;Height:525px; }. Ios7_b{-webkit-filter:Blur (8px) contrast (0.4) brightness (1.4);Clip:rect (205px 572px 516px 351px);Z-index: -;transition:All 0.5s ease-in-out; }. ios7_b_on{Clip:rect (516px 572px 516px 351px); }. Ios7_i{position:Absolute;Clip:rect (205px 572px 516px 351px); }. ios7_i img{Z-index: -;width:222px;Height:301px;Top:215px; Left:350px;position:Absolute;transition:All 0.5s ease-in-out; }. ios7_i_on img{Top:516px}

Js:

varimg = Document.queryselector ('. Ios7_i '));varback = Document.queryselector ('. Ios7_b '));d Ocument.onkeydown=function(e) {if(E.keycode = = ' 38 ') {Img.classname= ' Ios7_i '; Back.classname= ' Ios7_b '; return false; } Else if(E.keycode = = ' 40 ') {Img.classname+ = ' ios7_i_on '; Back.classname+ = ' ios7_b_on '; return false; }};

Demo:https://www.zhuwenlong.com/demo/ios7/ios7.html

Transferred from: https://www.zhuwenlong.com/blog/5242d5fc9ab354383d000001

"Turn" CSS3 realize iOS7 "frosted glass" blur effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.