jquery - How to fix the mask on the device screen -
now. there 2 buttons. if click 1 button, #mask show.
my target show web on mobile phone. tell truth, need tap 1 image inside in mobile view, image change size , show @ above of mobile view.(above means set => index: 99999);
this code.
<head> <meta charset="utf-8"> <title>textfixcover</title> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <link href="css/mui.min.css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="fonts/iconfont.js"></script> <style type="text/css"> html { background-color: #fff; height: 2000px; position: relative; } #mask { position: fix; top: 20px; left: 0; right: 0; height: 600px; display: none; background-color: greenyellow; z-index: 99999; } #mask .mui-slider { position: absolute; top: 20px; bottom: 0; left: 0; right: 0; height: 400px; } #bottom-btn { margin-top: 1400px; height: 100px; width: 100%; background-color: #4cd964; } #top-btn { margin-top: 400px; height: 100px; width: 100%; background-color: #ff5053; } </style> </head> <body> <section id="top-btn"></section> <select id="mask"> </select> <section id="bottom-btn"></section> <script type="text/javascript"> $('#top-btn').click(function(){ $('#mask').css('display','block'); settimeout(function(){ $('#mask').css('display','none'); },3000); }); $('#bottom-btn').click(function(){ $('#mask').css('display','block'); settimeout(function(){ $('#mask').css('display','none'); },3000); }); </script> </body> now face problem. if click bottom-btn, how set mask on current screen. set position on top of device window. in other words, mean fix mask on device screen, ignore web view scroll.
my aim when click bottom btn, see mask on device screen. don't need scroll web view.
i debug code on chrome console simulate mobile devices
it took me time understand problem , didn't until tested code myself. there slight mistake in code, need set position element of #mask position: fixed rather than, position: fix. 'fix' not value. once changed fixed, working think wish work.

Comments
Post a Comment