Namecheap.com - Cheap domain name registration, renewal and transfers - Free SSL Certificates - Web Hosting

Create Responsive Menu With the Help of TinyNav,js - Wordpress


Now-a-days Responsive web designs and developments are so familiar, because of  different screens with different screen size and resolutions. There are plenty of web designs available to use responsive web designs. Here i will give very small code to create responsive menu for your WordPress Website.

First of all download TinyNav.js from its Original Site or from github.

And make our theme folder and add your downloaded script into it. Then enqueue Your script into WordPress by the following code. Add it on your Theme "functions.php"

wp_enqueue_script('tinynav' , get_template_directory_uri() . '/js/tinynav.min.js' , array('jquery'));

and create your menu through your wordpress admin menu settings or else through code. and you have to make the menu inside a id name #topnav . Here is a sample code your source view of web page.



<ul id="topnav">
  <li class="selected"><a href="/">Home</a></li>
  <li><a href="/about/">About</a></li>
  <li><a href="/contact/">Contact</a></li>
</ul>



and your add a small code to sleep tinynav while your site is on big screens. It must be used for small screens  screen resolution is less than 600 px. and add this to your theme  "style.css"

/* styles for desktop */
.tinynav { display: none }

/* styles for mobile */
@media screen and (max-width: 600px) {
    .tinynav { display: block }
    #nav { display: none }
}
And hook your tiny with the help of jquery code. here it will help you to create responsive theme


<script>
  $(function () {
    $("#nav").tinyNav();
  });
</script>

Thats it you have done all necessary works to add tinynav.js. And Now check your website by using different screen size. Use screenfly or some other tools to may the changes giving effect or not.





3 Responses to “Create Responsive Menu With the Help of TinyNav,js - Wordpress”

Unknown said...
23 December 2014 at 07:53

I truly believe there is an skills to writing and creating content that only very few have and yes you got it. This is really useful and I will for sure affiliate my buddies the same. Thanks.

Wordpress Development Bangalore | Joomla Developers Bangalore


Anonymous said...
30 January 2017 at 01:18


This post is very usefull for me. A lots of thanks for sharing this informative post.

WordPress Tech Support


Unknown said...
14 July 2017 at 18:06

Learn how to start creating powerful websites & Blogs that helps you to build online presence on web & social media Best wordpress themes


Post a Comment

Namecheap.com - Cheap domain name registration, renewal and transfers - Free SSL Certificates - Web Hosting