{"action":"closed","issue":{"url":"https://api.github.com/repos/stevenwanderski/bxslider-4/issues/432","labels_url":"https://api.github.com/repos/stevenwanderski/bxslider-4/issues/432/labels{/name}","comments_url":"https://api.github.com/repos/stevenwanderski/bxslider-4/issues/432/comments","events_url":"https://api.github.com/repos/stevenwanderski/bxslider-4/issues/432/events","html_url":"https://github.com/stevenwanderski/bxslider-4/issues/432","id":26077681,"number":432,"title":"Slider loads last image first (with Fix)","user":{"login":"thdoan","id":4110567,"avatar_url":"https://avatars.githubusercontent.com/u/4110567?v=3","gravatar_id":"","url":"https://api.github.com/users/thdoan","html_url":"https://github.com/thdoan","followers_url":"https://api.github.com/users/thdoan/followers","following_url":"https://api.github.com/users/thdoan/following{/other_user}","gists_url":"https://api.github.com/users/thdoan/gists{/gist_id}","starred_url":"https://api.github.com/users/thdoan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thdoan/subscriptions","organizations_url":"https://api.github.com/users/thdoan/orgs","repos_url":"https://api.github.com/users/thdoan/repos","events_url":"https://api.github.com/users/thdoan/events{/privacy}","received_events_url":"https://api.github.com/users/thdoan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-01-22T09:52:59Z","updated_at":"2015-02-26T16:28:27Z","closed_at":"2015-02-26T16:28:27Z","body":"When infiniteLoop is enabled, the slider often loads showing the last image first on my system (if you can't reproduce it, try disabling browser cache and reloading using F5). Looking at the console, it seems that the slide is set to this initially:\r\n\r\n`webkit-transform: translate3d(-40px, 0px, 0px)`\r\n\r\n`-40px` points to the first cloned image, which is a cloned copy of the last image in the list (used in infinite scrolling). In this case, the setSlidePosition() function is not setting the correct initial position, possibly because it is somehow executing before the cloned elements are inserted by `el.append(sliceAppend).prepend(slicePrepend);`? I'm scratching my head...\r\n\r\nUPDATE\r\n\r\nAfter looking at the code, I understood what was happening -- setSlidePosition() is not yet aware of the infiniteLoop option. Here's the fix (beginning on line 494):\r\n\r\n```javascript\r\n// get the position of the first showing slide\r\nvar firstIndex = slider.active.index * getMoveBy(),\r\n  position = slider.children.eq(firstIndex).position();\r\n// check for last slide\r\nif (slider.active.index == getPagerQty() - 1) slider.active.last = true;\r\n// set the repective position\r\nif (position != undefined){\r\n  if (isVertical) {\r\n    if (slider.settings.infiniteLoop) position.top = (slider.active.index + 1) * slider.children.eq(firstIndex).outerHeight(true);\r\n    setPositionProperty(-position.top, 'reset', 0);\r\n  } else {\r\n    if (slider.settings.infiniteLoop) position.left = (slider.active.index + 1) * slider.children.eq(firstIndex).outerWidth(true);\r\n    setPositionProperty(-position.left, 'reset', 0);\r\n  }\r\n}\r\n```"}}