Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're not too heavily invested in CSS Media Queries, maybe you can try <a href="http://plugin.restive.io" rel="nofollow">Restive Plugin</a>. It makes things a little easier when you're building Responsive Web Sites (or Retrofitting Desktop Web Sites for Mobile). </p> <p>There's a 'Getting Started' guide here: <a href="http://blog.restive.io/posts/5852603/getting-started-with-restive-plugin" rel="nofollow">http://blog.restive.io/posts/5852603/getting-started-with-restive-plugin</a>, and an Operational Comparison with CSS Media Queries here: <a href="http://blog.restive.io/posts/4887492/css-media-queries-vs-restive-plugin" rel="nofollow">http://blog.restive.io/posts/4887492/css-media-queries-vs-restive-plugin</a></p> <p>Install and Setup for your specific case would be: </p> <pre><code>&lt;!-- Install JQuery version 1.7 or higher --&gt; &lt;script type="text/javascript" src="jquery.min.js"&gt;&lt;/script&gt; &lt;!-- Install Restive Plugin --&gt; &lt;script type="text/javascript" src="restive.min.js"&gt;&lt;/script&gt; &lt;!-- Setup Plugin --&gt; &lt;script&gt; $( document ).ready(function() { $('body').restive({ breakpoints: ['250', '320', '480', '620', '710', '940'], classes: ['rp_250', 'rp_320', 'rp_480', 'rp_620', 'rp_710', 'rp_940'], turbo_classes: 'is_mobile=mobi,is_phone=phone,is_tablet=tablet', force_dip: true }); }); &lt;/script&gt; </code></pre> <p><code>breakpoints</code> and <code>classes</code> manages your breakpoints and subsequent class additions to the DOM. So as you see above, Restive Plugin will create the following breakpoint ranges: <code>0 to 250</code>, <code>251 to 320</code>, <code>321 to 480</code>, <code>481 to 620</code>, <code>621 to 710</code>, and <code>711 to 940</code>. It will then add the corresponding values in <code>classes</code> as mobile devices match said breakpoints.</p> <p>So if an <code>iPhone 3GS</code> visits your Web Site, <code>rp_320</code> will be added to the <code>class</code> attribute of the <code>&lt;body&gt;</code> tag (since the device has a viewport width of 320 pixels [in portait]).</p> <p><code>turbo_classes</code> is a special feature of Restive Plugin that will add classes to the <code>&lt;body&gt;</code> tag on specific conditions being met. So if the device <code>is_mobile</code>, it will add <code>mobi</code>, if the device <code>is_phone</code> it will add <code>phone</code>, and so on. You can get more in-depth information from <a href="http://docs.restive.io/plugin" rel="nofollow">Restive Plugin Docs</a></p> <p><code>force_dip</code> forces Restive Plugin to use Device-Independent Pixels for <code>breakpoints</code> (the default behavior is for it to use Device Pixels) so that an <code>iPhone3GS</code> (Pixel Ratio of 1) and an <code>iPhone 4S</code> (Pixel Ratio of 2) will be caught by the same breakpoint i.e. <code>251 to 320</code>, which is what CSS Media Queries would do.</p> <p>So with our above setup, Restive Plugin will add <code>mobi phone rp_320</code> to the <code>class</code> attribute of the <code>&lt;body&gt;</code> tag if the device is an <code>iPhone 4S</code> or <code>iPhone 3GS</code>.</p> <p>Everything else you do after install and setup is pure CSS without media queries.</p> <p>So if you wanted to do something for devices caught by <code>251 to 320</code> breakpoint, you can simply add it to your CSS file e.g. your Menu-Bar Container:</p> <pre><code>.mobi.rp_320 .menuBarContainer {display: none;} </code></pre> <p>This will hide your menu bar for any device that falls within that breakpoint.</p> <p>However, you could also do something even more broad e.g. hiding your Menu-Bar Container on all phones (this is what <code>turbo_classes</code> enabled):</p> <pre><code>.mobi.phone .menuBarContainer {display: none;} </code></pre> <p>And you can do something similar for tablets as well:</p> <pre><code>.mobi.tablet .menuBarContainer {display: none;} </code></pre> <p>You now have freedom to build your Web Sites and setup complex behaviour arrangements using pure CSS and not having to worry about <code>@media</code> queries. Restive Plugin does a lot for you in the...errmm...frontend?!</p> <p>It might take getting used to a different mindset, but it'll probably help you be more nimble when building Responsive Web Sites in future.</p> <p><strong>Full disclosure</strong>: I developed the Plugin.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload