Dev Depot: Sidr, Mobile Friendly Side Menus

As the mobile Internet gains in popularity, screen sizes are shrinking, just as feature sets are growing. This induces a whole new set of issues for web designers seeking to fit links to all of the relevant products and services, without cluttering content or limiting the space available to display that content. One popular solution is the use of hidden menus that are only displayed in response to user input, expanding and collapsing as needed through the power of jQuery.

Sidr (www.berriart.com/sidr/) is a jQuery plugin by Alberto Varela for creating responsive, mobile friendly Facebook-style side menus, and claims to be the easiest way for making your website’s menus responsive.

In its simplest usage, webmasters create a DIV called sidr and place a menu there. The plugin is then activated by binding it to a hyperlink. By default, this menu will not be visible and will only be displayed or hidden by clicking on the link.

Varela was inspired by the way Facebook implements its menu on mobile devices.

“The major reason for creating this plugin was just being able to easily add existing content (like a menu, a search box, social icons, etc.) to a menu in small screens,” Varela explains. “Simply load existing HTML into a Sidr, and then, hide this HTML and show the menu button with media queries.”

“You will be able to create multiple Sidrs on both sides of your web page to make responsive menus (or not, it works perfectly on desktops too),” Varela adds. “Fill the Sidrs normally, with existing content, remote content, or whatever you want.”

In its simplest usage, webmasters create a DIV called sidr and place a menu there. The plugin is then activated by binding it to a hyperlink. By default, this menu will not be visible and will only be displayed or hidden by clicking on the link.

With Sidr you can create as many menus as you want on the same page, placing them at either the right or left side of the screen. When creating more than one menu, however, you need to name them with unique identifiers. If you do not create a container DIV for the menu, then the plugin will create it for you.

There are multiple ways to load content into Sidr menus, including external URLs and internal functions. In its simplest usage, it takes no more than placing the content into a DIV to create the menu, as seen in the example above.

“The most common way is to load existing HTML into the menu,” Varela states. “You can add as many selectors as you want and they will be loaded in order.”

Sidr makes it possible to load remote content easily via AJAX. For those who need a more complex way to load content into the menu, callback functions are easily created — as are more sophisticated responsive menus.

Sidr allows users to open or close menus programmatically and to bind them to any event, including using an external library to implement touch events, such as a right/left swipe touch event that opens or closes the responsive menu.

As with other plugins, Sidr must be included after the jQuery script call. Varela notes that a performance boost can be had by loading the script at the bottom of your web page, or asynchronously.

Sidr also includes two themes (style sheets) with the plugin, one dark, and a light one; although webmasters are not required to use these styles, they must then create their own.

The Sidr website offers several coding examples to get you quickly up and running, while providing inspiration for your own deployment methods.

If you’re looking for an attractive and accessible way to offer the most links in the least space, with a great user experience, then Sidr may be for you.

Related:  

Copyright © 2024 Adnet Media. All Rights Reserved. XBIZ is a trademark of Adnet Media.
Reproduction in whole or in part in any form or medium without express written permission is prohibited.

More Articles

profile

'Traffic Captain' Andy Wullmer Braves the High Seas as Spirited Exec

Wullmer networked and hobnobbed, gaining expertise in everything from ecommerce to SEO and traffic, making connections and over time rising through the ranks of several companies to become CEO of the mobile business arm of TrafficPartner.

Alejandro Freixes ·
opinion

To Cloud or Not to Cloud, That Is the Question

Let’s be honest. It just sounds way cooler to say your business is “in the cloud,” right? Buzzwords make everything sound chic and relevant. In fact, someone uninformed might even assume that any hosting that is not in the cloud is inferior. So what’s the truth?

Brad Mitchell ·
opinion

Upcoming Visa Price Changes to Registration, Transaction Fees

Visa is updating its fee structure. Effective April 1, both the card brand’s initial nonrefundable application fee and annual renewal fee will increase from $500 to $950. Visa is also introducing a fee of 10 cents for each settled transaction, and 10 basis points — 0.1% — on the payment volume of certain merchant accounts.

Jonathan Corona ·
opinion

Unpacking the New Digital Services Act

Do you hear the word “regulation” and get nervous? When it comes to the EU’s Digital Services Act (DSA), you shouldn’t worry. If you’re complying with the most up-to-date card brand regulations, you can breathe a sigh of relief.

Cathy Beardsley ·
opinion

The Perils of Relying on ChatGPT for Legal Advice

It surprised me how many people admitted that they had used ChatGPT or similar services either to draft legal documents or to provide legal advice. “Surprised” is probably an understatement of my reaction to learning about this, as “horrified” more accurately describes my emotional response.

Corey D. Silverstein ·
profile

WIA Profile: Holly Randall

If you’re one of the many regular listeners to Holly Randall’s celebrated podcast, you are already familiar with her charming intro spiel: “Hi, I’m Holly Randall and welcome to my podcast, ‘Holly Randall Unfiltered.’ This is the show about sex, the adult industry and the people in it.

Women In Adult ·
trends

What's Hot Now: Leading Content Players on Trending Genres, Monetization Strategies

The juggernaut creator economy hurtles along, fueled by ever-ascendant demand for personality-based authenticity and intimacy — yet any reports of the demise of the traditional paysite are greatly exaggerated.

Alejandro Freixes ·
opinion

An Ethical Approach to Global Tech Staffing

One thing my 24-year career as a technologist working to support the online adult entertainment industry has taught me about is the power of global staffing. Without a doubt, I have achieved significantly more business success as a direct result of hiring abroad.

Brad Mitchell ·
opinion

Finding the Right Payment Partner

Whenever I am talking with businesses that are just getting started, one particular question comes up a lot: “How do I get a merchant account?” It’s a simple question, but it has a complicated answer.

Jonathan Corona ·
opinion

The Taxman Cometh for Every Business

February may be the month of romance, but it is also a time when we need to think about something that inspires very little love: taxes. April is not far away, and the taxman is always waiting. This year, federal and most state income taxes are due Monday, April 15.

Cathy Beardsley ·
Show More