{"action":"created","issue":{"url":"https://api.github.com/repos/metafizzy/flickity/issues/369","repository_url":"https://api.github.com/repos/metafizzy/flickity","labels_url":"https://api.github.com/repos/metafizzy/flickity/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/metafizzy/flickity/issues/369/comments","events_url":"https://api.github.com/repos/metafizzy/flickity/issues/369/events","html_url":"https://github.com/metafizzy/flickity/issues/369","id":151496431,"number":369,"title":"Event for when Flickity reaches the next or previous slide","user":{"login":"gmossong","id":18605121,"avatar_url":"https://avatars2.githubusercontent.com/u/18605121?v=4","gravatar_id":"","url":"https://api.github.com/users/gmossong","html_url":"https://github.com/gmossong","followers_url":"https://api.github.com/users/gmossong/followers","following_url":"https://api.github.com/users/gmossong/following{/other_user}","gists_url":"https://api.github.com/users/gmossong/gists{/gist_id}","starred_url":"https://api.github.com/users/gmossong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmossong/subscriptions","organizations_url":"https://api.github.com/users/gmossong/orgs","repos_url":"https://api.github.com/users/gmossong/repos","events_url":"https://api.github.com/users/gmossong/events{/privacy}","received_events_url":"https://api.github.com/users/gmossong/received_events","type":"User","site_admin":false},"labels":[{"id":157826202,"url":"https://api.github.com/repos/metafizzy/flickity/labels/How%20do%20I?","name":"How do I?","color":"bfd4f2","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-04-27T21:33:33Z","updated_at":"2018-03-22T09:02:01Z","closed_at":"2016-05-24T19:46:07Z","author_association":"NONE","body":"This is more of [a question](http://stackoverflow.com/questions/36888490/event-for-when-flickity-reaches-the-next-or-previous-slide) which could turn into a **feature request** if it's not already available? \n\nIs there an event for when the next or previous slide is moved to? For example the settle event is fired after a slide settles. This does do what I need but the problem here is it also fires if Flickity settles on the same slide, this would happen if you swiped but didn't swipe enough and Flickity settles back where it was. The cellSelect demo appears to do much the same thing. In my mind something like this perhaps explains what I'm trying to achieve:\n\n``` javascript\n$carousel.on( 'nextSlideReached', function() {\n    console.log( 'Flickity has settled on the next slide' );\n});\n```\n"},"comment":{"url":"https://api.github.com/repos/metafizzy/flickity/issues/comments/375224695","html_url":"https://github.com/metafizzy/flickity/issues/369#issuecomment-375224695","issue_url":"https://api.github.com/repos/metafizzy/flickity/issues/369","id":375224695,"user":{"login":"tomevans18","id":7975064,"avatar_url":"https://avatars2.githubusercontent.com/u/7975064?v=4","gravatar_id":"","url":"https://api.github.com/users/tomevans18","html_url":"https://github.com/tomevans18","followers_url":"https://api.github.com/users/tomevans18/followers","following_url":"https://api.github.com/users/tomevans18/following{/other_user}","gists_url":"https://api.github.com/users/tomevans18/gists{/gist_id}","starred_url":"https://api.github.com/users/tomevans18/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomevans18/subscriptions","organizations_url":"https://api.github.com/users/tomevans18/orgs","repos_url":"https://api.github.com/users/tomevans18/repos","events_url":"https://api.github.com/users/tomevans18/events{/privacy}","received_events_url":"https://api.github.com/users/tomevans18/received_events","type":"User","site_admin":false},"created_at":"2018-03-22T09:02:01Z","updated_at":"2018-03-22T09:02:01Z","author_association":"NONE","body":"Just came across this trying to find a way to get the direction and realised myself that there is a dead simple way to do this (with React state)... \r\n\r\n`\r\nconstructor() {\r\n\tsuper();\r\n\t\r\n\tthis.flickity.on('select', ::this.handleSelect);\r\n}\r\n\r\ncomponentDidMount() {\r\n\tconst element = ReactDOM.findDOMNode(this.refs.items);\r\n\r\n\tthis.flickity = new Flickity(element, {\r\n\t\tprevNextButtons: false,\r\n\t\tpageDots: false,\r\n\t\tsetGallerySize: false,\r\n\t\twrapAround: true\r\n\t});\r\n}\r\n\r\nhandleSelect() {\r\n\tif (this.state.carouselIndex == this.flickity.selectedIndex) {\r\n\t\treturn;\r\n\t}\r\n\tthis.setState({\r\n\t\tcarouselIndex: this.flickity.selectedIndex,\r\n\t\tdirection: this.state.carouselIndex < this.flickity.selectedIndex ? 'right' : 'left'\r\n\t});\r\n}\r\n`\r\n\r\nThe just use `this.state.direction` = right or left."}}
{"actor":{"display_login":"tomevans18"}}