question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disable/Enable glide based on breakpoint

See original GitHub issue

Hey,

thanks for this great slider, really modern coding and good execution!

I am lacking a feature i was used from slick.js.

I want to be able to disable/enable the slider/carousel based on breakpoints, as you already have the breakpoint setting and the matchMedia implemented it would make sense to add this.

See the slick docs for an example: https://github.com/kenwheeler/slick#responsive-option-example

May add the option to set a breakpoint to false and check for the boolean?

PS: I know how to do it outside of glide, but it would be nice to do it all at once 😉

Greets Marcus

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:49
  • Comments:51 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
dorianfilippicommented, Jul 6, 2020

Simply with a bit of CSS

@media screen and (min-width: BREAKPOINT1) and (max-width: BREAKPOINT2) { .glide__slides { transform : initial !important; } }

Kisses

6reactions
davygxyzcommented, Aug 19, 2019

+1 as a workaround I created this function to help me at the moment. ` var glide = new Glide(‘.glide’) var stateBreakpoint = 768;

//Initial glide state
glideState(getWindowWidth(), glide, stateBreakpoint);

//On glide resize glide state
glide.on('resize', function() {
    glideState(getWindowWidth(), glide, stateBreakpoint);
});

/**
    * getWindowWidth
    * 
    * Gets the width of the current html document using the css property
    *
    * @return {int}
    */
    function getWindowWidth(){
    return parseInt($('html').css('width'));
}

/**
    * glideState
    *
    * Sets the state of the glide slider depending on breakpoint
    *
    * @param {string} width
    * @param {object} glide
    * @param {int} breakpoint
    * @return {void}
    */
function glideState(width, glide, breakpoint){
    if (width < breakpoint){
        glide.enable();
    }else{
        glide.disable()
    }
}`
Read more comments on GitHub >

github_iconTop Results From Across the Web

GlideJS - breakpoints example - CodePen
<div class="glide__track" data-glide-el="track">. 6. <ul class="glide__slides">. 7. <li class="glide__slide">1</li>. 8. <li class="glide__slide">2</li>.
Read more >
Can we PLEASE get an option to disable sliding : r/GhostRecon
I suggest to rename Breakpoint : "Ghost Recon: Sliding simulator 2019". ... Made a squad based off of MWII's Shadow Company.
Read more >
How to add slideWidth into a breakpoint in Glide.js
Here is a codepen on how to use the breakpoints https://codepen.io/tfoh/pen/zjqzZo new Glide('#glide1', { type: 'carousel', perView: 3, ...
Read more >
How to Base Jump in Ghost Recon Breakpoint - Shacknews
If you plan to Base Jump off a cliff, it's best you know what's required to open your parachute.
Read more >
Enable / Disable glider on a breakpoint? - Bountysource
Is it somehow possible to disable / destroy glider i.e on a certain breakpoint, maybe with responsive settings?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found