{"action":"created","issue":{"url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/546","labels_url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/546/labels{/name}","comments_url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/546/comments","events_url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/546/events","html_url":"https://github.com/defunkt/jquery-pjax/issues/546","id":96587613,"number":546,"title":"Scripts/code not firing on pjax:end, any thoughts?","user":{"login":"richgcook","id":901289,"avatar_url":"https://avatars.githubusercontent.com/u/901289?v=3","gravatar_id":"","url":"https://api.github.com/users/richgcook","html_url":"https://github.com/richgcook","followers_url":"https://api.github.com/users/richgcook/followers","following_url":"https://api.github.com/users/richgcook/following{/other_user}","gists_url":"https://api.github.com/users/richgcook/gists{/gist_id}","starred_url":"https://api.github.com/users/richgcook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richgcook/subscriptions","organizations_url":"https://api.github.com/users/richgcook/orgs","repos_url":"https://api.github.com/users/richgcook/repos","events_url":"https://api.github.com/users/richgcook/events{/privacy}","received_events_url":"https://api.github.com/users/richgcook/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-22T14:55:16Z","updated_at":"2015-07-22T18:22:26Z","closed_at":null,"body":"Hi @mislav, thanks continually for a great plugin.\r\n\r\nI'm running into a slight issue with refiring of scripts when pjax has finished/ended. If I refresh the browser on that page, the scripts work no problem, but on clicking/back (essentially with pjax is fired) my scripts never fire.\r\n\r\nFor example, I have this function,\r\n\r\n```js\r\nfunction imageSizes() {\r\n\t$('.chronology-container .each-chronology .image-container, body.works-detail .image-container').each(function() {\r\n\t\tvar div = $(this);\r\n\t\tvar img = $('img', div);\r\n\t\tif ( img.height() < img.width() ) {\r\n\t\t\tdiv.addClass('landscape');\r\n\t\t} else {\r\n\t\t\tdiv.addClass('portrait');\r\n\t\t}\r\n\t});\r\n}\r\n```\r\n\r\nAnd for pjax, I have:\r\n\r\n```js\r\n$(document).on('ready pjax:end', function() {\r\n    imageSizes();\r\n    $('.loader').fadeOut();\r\n});\r\n```\r\n\r\nBut the script never works until I refresh... any thoughts? Am I doing this right? This is just one example, but things from isotope to custom scripts rarely fire on pjax. The weird thing is that the loader always fades out so I know it's doing something.\r\n\r\nCheers,\r\nR"},"comment":{"url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/comments/123816259","html_url":"https://github.com/defunkt/jquery-pjax/issues/546#issuecomment-123816259","issue_url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/546","id":123816259,"user":{"login":"mislav","id":887,"avatar_url":"https://avatars.githubusercontent.com/u/887?v=3","gravatar_id":"","url":"https://api.github.com/users/mislav","html_url":"https://github.com/mislav","followers_url":"https://api.github.com/users/mislav/followers","following_url":"https://api.github.com/users/mislav/following{/other_user}","gists_url":"https://api.github.com/users/mislav/gists{/gist_id}","starred_url":"https://api.github.com/users/mislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mislav/subscriptions","organizations_url":"https://api.github.com/users/mislav/orgs","repos_url":"https://api.github.com/users/mislav/repos","events_url":"https://api.github.com/users/mislav/events{/privacy}","received_events_url":"https://api.github.com/users/mislav/received_events","type":"User","site_admin":true},"created_at":"2015-07-22T18:22:26Z","updated_at":"2015-07-22T18:22:26Z","body":"The event handler looks correct. You said the loader fades out after pjax has finished, so that means `imageSizes` definitely gets invoked. The problem probably lies within whatever that function is doing. Sprinkling logging or debugging statements in your code would be the fastest way to determine what's happening here and at which phase. Is anything stopping you from doing that?"}}