Off Canvas Filter added close button
-
Hello,
I couldn’t find an off canvas filter close button anywhere so I created the functionality, i’m pasting the code that needs to be added to your theme if you would like a close button.
In your styles file add the following:
/* * Add close button to off canvas sidebar in woocommerce shop page */ $( '.oceanwp-off-canvas-filter' ).on( 'click', function() { $( '.oceanwp-off-canvas-sidebar' ).removeClass( 'off-canvas-sidebar-hidden' ); $( '#oceanwp-off-canvas-sidebar-wrap' ).removeClass( 'off-canvas-sidebar-wrap-hidden' ); } ); $( '.close-off-canvas-sidebar' ).on( 'click', function() { $( 'body' ).removeClass( 'off-canvas-enabled' ); $( '.oceanwp-off-canvas-sidebar' ).addClass( 'off-canvas-sidebar-hidden' ); $( '#oceanwp-off-canvas-sidebar-wrap' ).addClass( 'off-canvas-sidebar-wrap-hidden' ); } );
In your styles file add the following:
.off-canvas-sidebar-wrap-hidden { -moz-opacity: 0 !important; -webkit-opacity: 0 !important; opacity: 0 !important; visibility: hidden !important; } .off-canvas-sidebar-hidden { right: -100%; } .close-off-canvas-sidebar { cursor: pointer; }
In /wp-content/themes/oceanwp-child-theme/woocommerce/owp-off-canvas-sidebar.php on line 13 (after ‘.oceanwp-off-canvas-sidebar’):
<div class="oceanwp-off-canvas-sidebar-close-btn"> <i class="fa fa-times close-off-canvas-sidebar" aria-hidden="true"></i> </div>
Enjoy!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Off Canvas Filter added close button’ is closed to new replies.