{"action":"created","issue":{"url":"https://api.github.com/repos/akiran/react-slick/issues/179","labels_url":"https://api.github.com/repos/akiran/react-slick/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/akiran/react-slick/issues/179/comments","events_url":"https://api.github.com/repos/akiran/react-slick/issues/179/events","html_url":"https://github.com/akiran/react-slick/issues/179","id":118784246,"number":179,"title":"error `currentSlide` increased in deactive window","user":{"login":"soulwu","id":1633638,"avatar_url":"https://avatars.githubusercontent.com/u/1633638?v=3","gravatar_id":"","url":"https://api.github.com/users/soulwu","html_url":"https://github.com/soulwu","followers_url":"https://api.github.com/users/soulwu/followers","following_url":"https://api.github.com/users/soulwu/following{/other_user}","gists_url":"https://api.github.com/users/soulwu/gists{/gist_id}","starred_url":"https://api.github.com/users/soulwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soulwu/subscriptions","organizations_url":"https://api.github.com/users/soulwu/orgs","repos_url":"https://api.github.com/users/soulwu/repos","events_url":"https://api.github.com/users/soulwu/events{/privacy}","received_events_url":"https://api.github.com/users/soulwu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-25T08:22:04Z","updated_at":"2016-02-01T14:09:35Z","closed_at":null,"body":"with props\r\n```js\r\n{\r\n  infinite: true,\r\n  autoplay: true,\r\n  useCSS: true\r\n}\r\n```\r\n\r\nhelper will run `autoplay` by `setTimeout` and increase the `currentSlide` state\r\nbut when I deactivate the window and turn it into background, css transition won't run, and no transitionEnd event triggered.\r\n\r\n[helpers.js#L252](/akiran/react-slick/blob/0.9.2/src/mixins/helpers.js#L252) would increase the currentSlide but can't adjust to corrent index [helper.js#L204](/akiran/react-slick/blob/0.9.2/src/mixins/helpers.js#L204)\r\n\r\nwhen I activate the window later, `currentSlide` already became a very large number, but only adjust by step [helpers.js#L144](/akiran/react-slick/blob/0.9.2/src/mixins/helpers.js#L144)\r\n\r\nI fixed this issue by change [helpers.js#L144](/akiran/react-slick/blob/0.9.2/src/mixins/helpers.js#L144) to\r\n```js\r\ncurrentSlide = targetSlide % this.state.slideCount;\r\n```\r\n\r\nthat's enough, but I suggest to put invoke of `autoplay()` inside animation callback"},"comment":{"url":"https://api.github.com/repos/akiran/react-slick/issues/comments/177988182","html_url":"https://github.com/akiran/react-slick/issues/179#issuecomment-177988182","issue_url":"https://api.github.com/repos/akiran/react-slick/issues/179","id":177988182,"user":{"login":"artempartos","id":1943859,"avatar_url":"https://avatars.githubusercontent.com/u/1943859?v=3","gravatar_id":"","url":"https://api.github.com/users/artempartos","html_url":"https://github.com/artempartos","followers_url":"https://api.github.com/users/artempartos/followers","following_url":"https://api.github.com/users/artempartos/following{/other_user}","gists_url":"https://api.github.com/users/artempartos/gists{/gist_id}","starred_url":"https://api.github.com/users/artempartos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artempartos/subscriptions","organizations_url":"https://api.github.com/users/artempartos/orgs","repos_url":"https://api.github.com/users/artempartos/repos","events_url":"https://api.github.com/users/artempartos/events{/privacy}","received_events_url":"https://api.github.com/users/artempartos/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T14:09:35Z","updated_at":"2016-02-01T14:09:35Z","body":"Need this PR too!"}}