user3596620
user3596620

Reputation: 37

Ionic Framework: how to disable bounce effect in slider box?

I'm currently working on an app that has fullscreen slides, the thing is that I want to be able to stop the bounce effect whenever I'm either on the first slide or the last slide.

That is, if I'm on the start slide, disable the bouncing effect when dragging from the left. Likewise, if I'm on the last slide, disable the bouncing effect when dragging from the right. Is there a way to implement this?

(I know that Ionic has attribute name hasBounce, but that only works for the ion-content directive, and it only works for the top and the bottom)

Upvotes: 3

Views: 3774

Answers (2)

soufien karray
soufien karray

Reputation: 91

working in ionic 1.3.1 ;)

i searched in lib/ionic/jsionic.bundle.js

.directive('ionSlideBox', [
  '$animate',
  '$timeout',
  '$compile',
  '$ionicSlideBoxDelegate',
  '$ionicHistory',
  '$ionicScrollDelegate',
function($animate, $timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory, $ionicScrollDelegate) {
  return {
    restrict: 'E',
    replace: true,
    transclude: true,
    scope: {
      autoPlay: '=',
      doesContinue: '@',
      slideInterval: '@',
      showPager: '@',
      pagerClick: '&',
      disableScroll: '@',
      onSlideChanged: '&',
      activeSlide: '=?',
      bounce: '@'
    },
....

, bounce: '@'

so bounce is working :)

<ion-slide-box bounce="false" ></ion-slide-box>

Upvotes: 0

vs4vijay
vs4vijay

Reputation: 1205

You could use has-bouncing on ion-content

<ion-content 
   has-bouncing="false"
   start-y="55"
   padding="true"
   has-tabs="true"
   has-header="true">

Upvotes: 5

Related Questions