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.

Ionic 4.beta3 slidebox lockSwipes() is not working

See original GitHub issue

On doing swipe lock I am getting an error.

updateSlideBox() {
            var slideController = document.querySelector(".slidernow");
            slideController.componentOnReady().then(function () {
              slideController.update();
              slideController. lockSwipes();
            });
        }
jepizrms.js:5 Uncaught (in promise) TypeError: this.swiper.unlockSwipeToNext is not a function
    at k.lockSwipeToNext (jepizrms.js:5)
    at eval (Airport.js?3dca:146)

I can tell slideTo is working fine but locking swipes of slides is throwing error.

Ionic version:

<script src="https://unpkg.com/@ionic/core@4.0.0-beta.3/dist/ionic.js"></script>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
fabrvcommented, Sep 13, 2018

LockSwipes() isn’t working but I found a workaround.

You have to disable swiping from the ‘Sliders’ options. There are a couple of ways of doing it (check Swiper Docs) but this is how I did it:

HTML:

<ion-slides [options]="slideOpts"></ion-slides>

TS:

slideOpts: any = {allowTouchMove: false};

LockSwipes( lock: boolean ){
  if (lock == true){
    this.slideOpts =  {allowTouchMove: true};
  }else{
    this.slideOpts =  {allowTouchMove: false};
  }
}

With this code simply call the function LockSwipes and you are ready to go. 😃

1reaction
paulstelzercommented, Dec 3, 2018

This is issue should be resolved in beta.17. If I am wrong, please write here!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ionic slider - lockSwipes(true) disables initialSlide and ...
Yes, by looking at the source code for lockSwipes() , it seems like the functions slideNext and slidePrev gets 'locked':
Read more >
Ionic slider - lockSwipes(true) disables initialSlide and ...
hi I'm using ionic slider to display todo lists and I want to disable the swipe guestures since my list items have them....
Read more >
Ion-slides 禁用滑动ionic 4 - 免费编程教程
Ionic 4.beta3 滑动框lockSwipes() 不起作用· 问题#15310 ... 一年多前,我写了一篇文章(“Ionic Example: ion-slide-box”),演示了如何在Ionic 1 中 ...
Read more >
Ionic - JavaScript Slide Box - Tutorialspoint
You just need to add ion-slide-box as a container and ion-slide with box class inside that container. We will add height and border...
Read more >
Ionic Example: ion-slide-box - Raymond Camden
$apply() solution you see above. That made it work perfectly. All in all, a simple demo, but I hope this is useful for...
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