0

I have a jQuery toggle that switches content on my page. I would like to be able to slide it left and right on mobile, is there any way to do this? Code below

<label class="toggle-label toggler" id="toggle"><input id="rdb1" type="checkbox" name="toggler" checked="true"/><span class='back'>
<span class='toggle'></span>
<span class='label on'>Option One</span>  
<span class='label off'>Option Two</span>
</span></label>

<div id="blk-1" class="toHide">
Content One
</div>

<div id="blk-2" class="toHide" style="display:none">
Content Two
</div>

  $("[name=toggler]").click(function() {
  $('.toHide').hide();
  var toShow = $(this).is(":checked") ? "blk-1" : "blk-2";
 $("#" + toShow).toggle(1);
});

https://jsfiddle.net/gabbymarley/7qo0ksab/1/ Here is a fiddle of the code

2

0

Browse other questions tagged or ask your own question.