Off Canvas element from Sidebar

I’m looking to add one of the “content area off canvas elements” to be triggered from a sidebar button. I’ve been using these to handle our Forms (GF shortcode) and it is really nice–but we’d like to be able to include this same experience across the blogs as well.

I had hoped to be able to include a button to the sidebar which triggers the off-canvas element.

Any thoughts?

Hello @speckledjay,

Thanks for writing in! Regretfully there isn’t a feature yet that you can add an off canvas element to be trigger by a regular button in the sidebar. So far, off canvas content area element is only available for the custom header, custom footer and in the content area. You may add the off canvass element in one of the mentioned areas of the page and then make use of a simply javascript so that when you click a button in your sidebar, it will trigger the off canvas content area element as well. Please set up the button and the off canvas content area first and then get back to us so that we can provide the custom javascript like this:

(function($){
  $('#my-button-ID').on('click touchstart', function(){
    $('#off-canvas-ID').trigger('click');
  });
})(jQuery);

Please let us know how it goes.

Thank You … unfortunately I do need this to run from a “sidebar” I’ll explore a bit more with this code though.

You’re welcome! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.