{"action":"opened","issue":{"url":"https://api.github.com/repos/miguel-perez/smoothState.js/issues/245","labels_url":"https://api.github.com/repos/miguel-perez/smoothState.js/issues/245/labels{/name}","comments_url":"https://api.github.com/repos/miguel-perez/smoothState.js/issues/245/comments","events_url":"https://api.github.com/repos/miguel-perez/smoothState.js/issues/245/events","html_url":"https://github.com/miguel-perez/smoothState.js/issues/245","id":129490385,"number":245,"title":"onReady and onAfter fire multiple times","user":{"login":"coffein","id":4940316,"avatar_url":"https://avatars.githubusercontent.com/u/4940316?v=3","gravatar_id":"","url":"https://api.github.com/users/coffein","html_url":"https://github.com/coffein","followers_url":"https://api.github.com/users/coffein/followers","following_url":"https://api.github.com/users/coffein/following{/other_user}","gists_url":"https://api.github.com/users/coffein/gists{/gist_id}","starred_url":"https://api.github.com/users/coffein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coffein/subscriptions","organizations_url":"https://api.github.com/users/coffein/orgs","repos_url":"https://api.github.com/users/coffein/repos","events_url":"https://api.github.com/users/coffein/events{/privacy}","received_events_url":"https://api.github.com/users/coffein/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-28T15:54:10Z","updated_at":"2016-01-28T15:54:10Z","closed_at":null,"body":"Hello,\r\n\r\nI've got a small problem:\r\nIf I click some links, everything works fine. If I click a link again that I already clicked, onReady and onAfter fire two times. The more I change pages, the more the events fire after a pageload.\r\n\r\nThis is my js-code:\r\n\r\n```\r\n$(function(){\r\n  'use strict';\r\n  var $page = $('#main'),\r\n      options = {\r\n        debug: true,\r\n        prefetch: true,\r\n        cacheLength: 2,\r\n        onStart: {\r\n          duration: 250, // Duration of our animation\r\n          render: function ($container) {\r\n            // Add your CSS animation reversing class\r\n            $container.addClass('is-exiting');\r\n            // Restart your animation\r\n            smoothState.restartCSSAnimations();\r\n          }\r\n        },\r\n        onReady: {\r\n          duration: 0,\r\n          render: function ($container, $newContent) {\r\n            // Remove your CSS animation reversing class\r\n            $container.removeClass('is-exiting');\r\n            // Inject the new content\r\n            $container.html($newContent);\r\n            window.console.log('asdf');\r\n          }\r\n        },\r\n        onAfter: function($container, $newContent) {\r\n          window.console.log('fired');\r\n          //fireUp();\r\n        }\r\n\r\n      },\r\n      smoothState = $page.smoothState(options).data('smoothState');\r\n});\r\n```\r\n\r\n\r\n\r\nThe element with the main-id is a wrapper div after the body."}}