Software Programming

Kunuk Nykjaer

Responsify website with Javascript

leave a comment »


Responsifyer – prototype tool for making a webpage responsive

Available at Github

If you have a webpage which is not responsive and wants to get an idea how it would be if it was responsive then you can test it by running this script in the browser.

This is only to be used as a prototype tool for making a page responsive.
This uses jQuery. If jQuery is not already available it will be loaded from a CDN site.

Usage:
Copy the code and run this code in the browser console.

You can test it with sites which are not fully responsive like Stackoverflow, Apple or
Yahoo (At the time i wrote this blog they were not fully responsive).

Change the width of the browser screen and see how the content adapts.

Tables can be hard to make responsive. You can set responsifyTables to true at the bottom of this script or run in the console after this script has been executed: responsifyer.responsifyTables()


How it works:
The script first loads jQuery if it is not already present.
Then it recursive works on the DOM from the root node. After the recursion is finished there are specific node elements which are set specifically.

Advertisements

Written by kunuk Nykjaer

December 14, 2014 at 5:16 pm

Posted in Javascript

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: