freeli
<!DOCTYPE html> <html> <head> <meta charset=UTF-8 /> <title>jquery实现div自适应浏览器高度(宽度)</title> <meta name="keywords" content="html5" /> <meta name="description" content="html5 test" /> <script type="text/javascript" src="jquery-1.7.1.min.js"></script> <script type="text/javascript"> function autoHeight() { var h = $(window).height(); var h_old = 300; if (h > h_old) { $(".left").css(\'height\', h); } else { return false; } } $(function() { autoHeight() $(window).resize(autoHeight); }) </script> <style type="text/css"> html, body { margin: 0; height: 100%; } .left { width: 100px; background: #E8EFF6; margin-left: 100px; } </style> </head> <body> <div class="left"> das </div> </body> </html>

分类:

技术点:

相关文章:

  • 2021-12-23
  • 2021-12-23
  • 2021-04-27
  • 2021-12-22
  • 2021-12-22
  • 2021-12-08
  • 2021-10-17
猜你喜欢
  • 2021-09-07
  • 2021-10-27
  • 2021-12-12
  • 2021-12-21
  • 2021-09-25
  • 2021-12-09
  • 2021-10-01
相关资源
相似解决方案