How to use this switcheroo plugin but not for displaying product?
but not for the functionality shown on the demo page.
It took me some hours to find it but it may have been for nothing.
Here is the example html source that makes it work, taken from a phpbb theme that uses the switcheroo plugin:
- <div class="responsive">
- <!-- Mobile Button -->
- <div class="mobile-btn pull-right hidden-xs">
- <a href="#" title="Smartphone View" ><i class="icon-mobile-phone"></i></a>
- </div>
-
- <!-- Tablet Button -->
- <div class="tablet-btn pull-right hidden-xs">
- <a href="#" title="Tablet View" ><i class="icon-tablet"></i></a>
- </div>
-
- <!-- Desktop Button -->
- <div class="desktop-btn pull-right hidden-xs">
- <a href="#" title="Desktop View" class="active"><i class="icon-desktop"></i></a>
- </div>
- </div>
The js:
-
- $(".responsive a").click(function(){
- // If this isn't already active
- if (!$(this).hasClass("active")) {
- // Remove the class from anything that is active
- $(".responsive a.active").removeClass("active");
- // And make this active
- $(this).addClass("active");
- }
- });
It seems they use an iframe to render the page width onclick, is that the best way to achieve this?
I'm stuck at what css they add and what class they add it to or just to the style attribute of the iframe. I guess that magic happens inside the plugin itself?
Tried it out;