Adaptive JSS: looking for an optimum approach



  • How do you know that there's a copper demand. CSS may not be sufficient for a normal adaptive plug, and when the flow composition and flow itself need to be changed, it must be used JavaScript

    If the challenge was simply to unite the flow to the size of a smartphone window, suggesting that then the width of the window would change many times. Not If there were, technical problems. My job is, regardless of the device (smartphone, disktop or tablet) changes the styles and vertebrals as long as window size changes are not made.

    I see an optimum approach in this task:

    1. We're doing a basic gig: everything inside. <body>We're rolling in. <noscript>♪ Now the site will be displayed when the Javascript is off. At this stage, we'll have an empty page with a stained JS.
    2. All HTML objects, together with attributes (including classes and ID) in the external JS file; each group of objects (heads, tables and other constituent objects) make the variable value.
    3. Writing function BodyResize(), which will remove everything inside every change of window size <body> and build a new flow.
    4. All styles will be stored in the CSS file; once the flow is built, the required styles will be used.

    Once again, all this masochism is needed then to change the width of the window unlimited number of times, and regardless of the width of the original, the necessary flow will be created (with all my respect for the author, https://myrusakov.ru/jquery-adaptive.html The approach does not solve this task: it will only singlely flow when the page is downloaded. I've been trying to modify this scenario so that it works on every change in the size of the window, but only the movement and supply of objects.insertAfterpreprendTo (e.g.) The challenge is not to solve: each in this way generates the right flow for a specific range of widths, all combinations must be described. else if for each reference and final width of the window.

    So, questions:

    1. What are the disadvantages of the above approach (except low loading speed)?
    2. What are the best approaches you can offer (except RESS; this approach is implemented only by a group of professionals)?
    3. Please bring 2-3 lines of the code of the empty function of the JS, which works both at the first download of the page and when the window size changes (i can only implement one thing so far).


  • onload, onresize

    function f(){....}
    

    window.onload = function() {
    window.onresize = f;

     f()
    

    }




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2