Git Product home page Git Product logo

visual-screen's Introduction

Visual-Screen

自适应浏览器的大数据展示WEB页面 研究了好久, 该页面可以自适应浏览器宽高,内部元素不会因为浏览器大小变化而导致位置偏移 现在分享该自适应的方法给大家(之前一直都是动态改变 height width 和 left top,这种方法很浪费性能)

在body里面设置一个div容器 然后在这个容器内部写各种元素 只要设置好每个内部元素的 left top width height(不要用百分比的值 直接用px就可以了 然后设置文档页面大小变化的事件)

//随着浏览器窗体缩放页面

function scale(SCALE) {

  var winWidth = screen.width;
  var winHeight = screen.height;
  var docWidth = $(window).width();
  var docHeight = $(window).height();
  var wp = docWidth / winWidth / SCALE;//宽度缩放比例
  var hp = docHeight / winHeight / SCALE;//高度缩放比例
  var $div = $('#content');
  $div.css('transform', "scale(" + wp + "," + hp + ")");
  $div.css('transform-origin', "0 0");

}

正常页面
正常页面

变窄
变窄

变宽
变宽

正常页面2
正常页面2

visual-screen's People

Contributors

zj69719496 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.