自适应屏幕
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了自适应屏幕,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1505字,纯文字阅读大概需要3分钟。
内容图文
1 < div id ="center1" class ="cen_container" > 2 < div class ="center1_bg" > 3 < img src ="../css/images/index.jpg" > 4 </ div > 5 < div class ="center1-content" > 6 < div class ="dataBlock" ></ div > 7 < div class ="searchBlock" ></ div > 8 < div class ="callBlock" ></ div > 9 </ div > 10 </ div >
1 #center1{ width:100%;min-height:634px !important;position: relative; margin:0 auto;position: relative;} 2.center1_bg{width: 100%;height: 100%;background: url("../images/index_1.jpg") center center no-repeat;position: absolute;top: 0;left: 0;z-index: -1;} 3.center1_bg img{width: 100%;height:auto;min-width: 1350px;} 4.center1-content{width: 990px;height: 100%;margin: 0 auto;position: relative;}
1 var change_c1 = function(){ 2var w_height = $(window).height(); 3var img_r = 1920 /1080; 4var window_r = $(window).width() / $(window).height(); 5if(window_r >= img_r){ 6 $(".center1_bg img").css({ 7 ‘width‘ : ‘100%‘, 8 ‘height‘ : ‘auto‘ 9 }); 10 }else{ 11 $(".center1_bg img").css({ 12 ‘width‘ : ‘auto‘, 13 ‘height‘ : ‘100%‘ 14 }); 15 } 16var cen1_height = (w_height - 80 + 37) >= 600 ? (w_height - 80 + 37) : 600; 17 $(‘#center1,.center1_bg‘).height(cen1_height + ‘px‘); 18var resizeTimer = null; 19 $(window).on(‘resize‘, function () { 20if (resizeTimer) { 21 clearTimeout(resizeTimer) 22 } 23 resizeTimer = setTimeout(function(){change_c1();}, 200); 24 } 25 ); 26 }
原文:http://www.cnblogs.com/jymz/p/3997917.html
内容总结
以上是互联网集市为您收集整理的自适应屏幕全部内容,希望文章能够帮你解决自适应屏幕所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。