Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cause OffCanvas to appear on page load with out slide animation? #37

Closed
JadeDaniel opened this issue Sep 27, 2018 · 0 comments
Closed

Comments

@JadeDaniel
Copy link

JadeDaniel commented Sep 27, 2018

Hi! Thank you for the lovely plugin.

I am using jQuery to force open the offcanvas on page load, but this is done using the standard sliding animation and when paging through the site multiple sliding animations become distracting.

Is there a way to force offCanvas to abandon the sliding animation for a particular open operation OR to make it load in an opened state?

Thanks

// Define offcanvas-js dataOffcanvas object
      var dataOffcanvas = $('#off-canvas').data('offcanvas-component');

      // Responsive Open/close
      responsiveHamburger = function() {
        if (window.innerWidth > 768) { dataOffcanvas.open(); }
        else { dataOffcanvas.close(); }
      }
      // If window width > 768px then automatically open hamburger menu, wait for resize to stop
      var responsiveHamburger_lazy = _.debounce(responsiveHamburger,100);
      $(window).resize(responsiveHamburger_lazy);

      // Remove d-none from aside one the page is fully loaded (fixes flickering)
      $("aside").removeClass("d-none");

      // Open/Close based on screen size on load
      responsiveHamburger();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant