/**
jPack ToggleOnMobile Demo
https://htmlguyllc.github.io/jPack/#toggleonmobile
As you can see, on desktop, the sidebar is always visible for a slick shopping experience.
However on mobile, where the sidebar would take up too much space it becomes an absolutely positioned modal which you can open by clicking the link.
If you click outside the modal, it goes away.
If you resize your screen, you can see the sidebar hide on mobile, show on desktop.
This is all based on the visibility of the toggle button. As long as your media queries control the button, this plugin will do the rest.
The plugin just toggles a class, so in theory, you can do almost anything with the sidebar on mobile.
You can have it slide in and continue to take up space on the page by pushing the results off-screen to the right, you can use the styling shown here where it's like a modal, you can have it display inline but above the results, etc. The possibilities are endless.
*/
var togglers = [];
//only takes a single line to enable this functionality
togglers.push(new jpack.ToggleOnMobile('.toggle1', '.sidebar1').init());
//a second version which displays inline
togglers.push(new jpack.ToggleOnMobile('.toggle2', '.sidebar2').init());
//a third version which slides in from the side above the content
togglers.push(new jpack.ToggleOnMobile('.toggle3', '.sidebar3').init());
//destroy all
/*
togglers.forEach(function(toggler){
toggler.destroy();
});
*/
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.