下拉菜单卡顿
代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | <!DOCTYPE html> < html > < head > < meta charset = "UTF-8" > < title >Document</ title > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < link rel = "stylesheet" href = "./style/style.css" > < script src = "https://cdn.bootcss.com/jquery/1.12.1/jquery.js" ></ script > </ head > < body > < header > < nav class = "insteadnav" > IMOOC< a class = "button" >▼</ a > </ nav > < div class = "navbox" > < a class = "nav" href = "#" >前端</ a > < a class = "nav" href = "#" >Java</ a > < a class = "nav" href = "#" >iOS</ a > < a class = "nav" href = "#" >Android</ a > < a class = "nav" href = "#" >PHP</ a > </ div > </ header > < section class = "sec1" > < img src = "./img/1.png" > < p >IMOOC</ p > < input type = "button" value = "START" > </ section > < section class = "sec2" > < p >关于慕课网</ p > < p >关于课程</ p > < p >核心团队</ p > < p >新增专题</ p > </ section > < section class = "sec3" > < article > < p >响应式</ p > < p >響應式網頁設計(英语:Responsive web design,通常縮寫为RWD),或稱自适应网页设计、回應式網頁設計、對應式網頁設計。 是一种网页设计的技術做法,该设计可使网站在不同的設備(从桌面电脑显示器到移动电话或其他流動產品裝置)上瀏覽時對應不同解析度皆有適合的呈現,减少使用者進行缩放、平移和滚动等操作行為。</ p > </ article > </ section > < section class = "sec4" > < p >IMOOC</ p > < p >Welcome to < span >www.imooc.com</ span ></ p > </ section > < section class = "sec5" > < p >主打课程</ p > < div class = "piccontainer" > < img src = "./img/1.jpg" > < img src = "./img/2.jpg" > < img src = "./img/3.jpg" > < img src = "./img/4.jpg" > < img src = "./img/5.jpg" > < img src = "./img/6.jpg" > </ div > </ section > < section class = "sec6" > < p >Copyright ©2017 imooc.com All Rights Reserved</ p > </ section > < script src = "./js/js.js" ></ script > </ body > </ html > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | * { margin : 0 ; padding : 0 ; text-decoration : none ; list-style : none ; } header { display : flex; justify- content : center ; align-items: center ; align-self: center ; background-color : #B2C5CC ; height : . 3 rem; font-size : . 1 rem; } header > .insteadnav { display : none ; } header a { width : . 5 rem; color : #757575 ; text-align : center ; font-size : . 1 rem; padding : 10px 0 ; } header > a:not(:first-child):hover { color : #afafaf ; background-color : rgb ( 255 , 255 , 255 ); transition: color 1 s; transition: background-color 1 s; } .sec 1 { width : 100% ; height : 2.5 rem; background-color : #B2C5CC ; display : flex; flex- direction : column; align-items: center ; font-size : . 1 rem; } .sec 1 img { width : . 5 rem; height : . 5 rem; margin-bottom : 40px ; margin-top : 30px ; } .sec 1 p { color : white ; font-size : . 14 rem; margin-bottom : 40px ; } .sec 1 input { font-size : . 15 rem; background-color : white ; padding : 10px 20px ; color : #757575 ; border : none ; transition: color 1 s; } .sec 1 input:hover { cursor : pointer ; color : #afafaf ; transition: color 1 s; } .sec 2 { display : flex; height : . 6 rem; border-bottom : 2px solid rgba( 200 , 200 , 200 , . 6 ); justify- content : space-around; align-items: center ; font-size : . 1 rem; } .sec 2 p { width : 20% ; text-align : center ; color : #bababa ; transition: color 1 s; } .sec 2 p:hover { color : #545454 ; transition: color 1 s; } .sec 3 article { display : flex; width : 100% ; height : 3.5 rem; flex- direction : column; justify- content : center ; align-items: center ; } .sec 3 article p { width : 45% ; } .sec 3 article p:nth-child( 1 ) { font-size : . 2 rem; font-weight : bold ; text-align : center ; height : 40px ; margin-bottom : . 2 rem; } .sec 3 article p:nth-child( 2 ) { font-size : . 1 rem; text-align : justify ; line-height : 2em ; } .sec 4 { height : 100px ; display : flex; justify- content : space-between; align-items: center ; color : #aaa ; background-color : #f4f4f4 ; padding : 0px 80px ; font-size : . 1 rem; } .sec 4 p:nth-child( 1 ) { font-size : . 2 rem; } .sec 4 p:nth-child( 2 ) span { color : black ; font-size : . 1 rem; } .sec 5 { width : 100% ; height : 800px ; background : url ( "../img/bg.jpg" ) no-repeat 100% 100% ; display : flex; flex- direction : column; justify- content : space-around; font-size : . 1 rem; } .sec 5 p { margin-top : 50px ; margin-left : 80px ; font-size : . 15 rem; } .sec 5 .piccontainer { display : flex; flex-wrap: wrap; justify- content : space-around; align- content : space-around; } .sec 5 .piccontainer img { width : 25% ; height : 270px ; margin : 20px ; transition: all . 4 s; } .sec 5 .piccontainer img:hover { cursor : pointer ; transform: scale( 1.2 ); } .sec 6 { height : 80px ; line-height : 80px ; font-size : . 1 rem; background-color : #eee ; text-align : center ; } @media screen and ( max-width : 400px ) { header { display : flex; flex- direction : column; height : 1.3 rem; z-index : 2 ; justify- content : flex-start; } header>.insteadnav { display : block ; width : 100% ; text-align : center ; font-size : . 18 rem; line-height : . 26 rem; padding : . 05 rem 0 ; z-index : 2 ; background-color : #7EA6B1 ; color : white ; } header>.insteadnav>.button { position : absolute ; top : -. 05 rem; right : . 2 rem; z-index : 2 ; } header .navbox{ display : none ; position : relative ; z-index : 888 ; width : 100% ; } header .nav { display : block ; width : 100% ; background-color : #7EA6B1 ; /*z-index: 2;*/ border-bottom : 1px solid rgba( 200 , 200 , 200 , . 5 ) } .sec 4 { display : flex; flex- direction : column; justify- content : center ; } .sec 5 { width : 100% ; height : 4 rem; padding-bottom : . 2 rem; } .sec 5 p { margin-left : . 16 rem; font-size : . 15 rem; } .sec 5 .piccontainer img { width : 40% ; height : 1 rem; margin : . 04 rem; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | $(document).ready( function () { ( function (win, doc) { var docEl = doc.documentElement, resizeEvt = 'orientationchange' in window ? 'orientationchange' : "resize" , recalc = function () { var clientWidth = docEl.clientWidth; if (!clientWidth) return ; if (clientWidth <= 400) { docEl.style.fontSize = '100px' ; } else { docEl.style.fontSize = 100 * (clientWidth / 400) + 'px' ; } }; if (!doc.addEventListener) return ; win.addEventListener(resizeEvt, recalc, false ); doc.addEventListener( 'DOMContentLoaded' , recalc, false ); recalc(); })(window, document) $( ".button" ).click( function (){ $( ".navbox" ).animate({ 'height' : 'toggle' , }); }) }); |
按照老师的作业点评修改后,iphone6分辨率下浏览,下拉菜单仍然卡顿?
39
收起
正在回答 回答被采纳积分+1
2回答
响应式开发与常用框架 2018
- 参与学习 人
- 提交作业 2198 份
- 解答问题 5012 个
如果你有web端基础,既想进阶,又想进军移动端开发,那就来吧,我们专题为你带来的课程有HTML5、CSS3、移动基础、响应式、bootstrap、less等,让你在前端道路上畅通无阻!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧