pedroabreu / ion-gallery

Ionic gallery directive
MIT License
124 stars 61 forks source link

Fix issue with slider only cycling through 3 #10

Closed popcorn245 closed 8 years ago

popcorn245 commented 8 years ago

The carousel will only loop through 3 photos unless I made this fix. Hope this can make it into the repo so others don't suffer the same fate. Thanks! ^_^

pedroabreu commented 8 years ago

What was the change/fix ? Can't really see the difference in the PR

popcorn245 commented 8 years ago
var slidePosition = lastSlideIndex + '>' + currentSlideIndex;

Without this fix the slidePosition varaible is unset and causes the carousel to only go through 3 images at a time. Other one just fixed the .gitignore so it ignores your .tmp directory. You also need to wrap this in a try/catch so it doesn't cause an error when someone navigates away from the page where this gallery exists and doesn't use the modal.

scope.$on('$destroy', function() {
    _modal.remove();
});