3-Level Dropdown from 1-Level Menu by Myri (@mynimi) on CodePen.
In this Tutorial I don’t want to go over how this menu works, but how to integrate it into the blog (I do plan on writing a tutorial on the dropdown, though).
It is always best to test something new in a testblog, before you put it on your live blog, even though this should work out in most cases at the first try. Also, since this is a responsive menu, you should use a responsive template. If you don’t have one and don’t feel like writing your own, you are very welcome to take a look at some of my templates.
Okay, log into blogger and let’s get started.
First open the layout tab of your blog and create a new link list. It does not matter where you put it, since the navigation will be fixed anyways. But because I’d like to mention some logic, I would place it somewhere around the top.
Now on how you build your link list. Order does matter here.
Subelements for the second level start with an _
and elements of the third level, start with two underscores __
For the correct order, you need to put the grandchildren underneath the children and the children below the parent.
Save.
Now personalize the dropdown.
The first thing you want to find out though is how the list is called.
So you want to inspect the element with the inspector that ships with every good browser. (right-click, inspect element).
If you just have one linklist within your blog, you can work with the class. But since the linklist widget is pretty popular, and you don’t want to cause any confusion, it is easiest to work with the ID.
So go check it out. For me the Id is LinkList1
Next open my CodePen
YOu don’t have to make any changes within my javascript, if you want to use my CSS and are happy with the way I’ve named the classes. But there are two variables, you should/can customize.
Search for
You should replace the first $('ul)
with the correct identifier of your linklist. The second variable is how you want the button to be called in the responsive view. In the example I wanted to change that to “Navigation” So after my changes are done, that’s how it looks like:
Since the styles are written in Sass, it is very easy to customize. I did explain all of the variables, so it should be easy to adjust.
As soon as you adjusted the colors, you are ready to put together your HTML widget.
Okay, what is all going into the widget?
The menu depends on Font Awesome Icons, so that’s what I’ll add in there as well. And because the js was written in jQuery, you want to make sure, that that’s added as well. If it is already part of your blog, you don’t need to add it again, though.
I just put everything in a HTML widget, but if you are not afraid of your code, feel free to add it in the respective places within the template.
Copy all of the javascript. For the CSS, you click on view compiled and get the generated CSS. Then look for:
And copy everything below that line, as per instructions.
An that’s the content of your HTML widget.
Sometimes Blogger likes to be annoying.
If something does not work out as expected, it might be because the CSS of the widget is interfering with the new CSS:
In that case take your ID of the linklist again and add one more line at the end of the script.
And then it should work. Of course you could just overwrite the styles, but removing the class altogether often seems the cleaner and faster solution.