{"action":"closed","issue":{"url":"https://api.github.com/repos/smalot/bootstrap-datetimepicker/issues/508","repository_url":"https://api.github.com/repos/smalot/bootstrap-datetimepicker","labels_url":"https://api.github.com/repos/smalot/bootstrap-datetimepicker/issues/508/labels{/name}","comments_url":"https://api.github.com/repos/smalot/bootstrap-datetimepicker/issues/508/comments","events_url":"https://api.github.com/repos/smalot/bootstrap-datetimepicker/issues/508/events","html_url":"https://github.com/smalot/bootstrap-datetimepicker/issues/508","id":142908847,"number":508,"title":"Position changed after 1st click on picker in bootstrap3","user":{"login":"netwww1","id":17537636,"avatar_url":"https://avatars.githubusercontent.com/u/17537636?v=3","gravatar_id":"","url":"https://api.github.com/users/netwww1","html_url":"https://github.com/netwww1","followers_url":"https://api.github.com/users/netwww1/followers","following_url":"https://api.github.com/users/netwww1/following{/other_user}","gists_url":"https://api.github.com/users/netwww1/gists{/gist_id}","starred_url":"https://api.github.com/users/netwww1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netwww1/subscriptions","organizations_url":"https://api.github.com/users/netwww1/orgs","repos_url":"https://api.github.com/users/netwww1/repos","events_url":"https://api.github.com/users/netwww1/events{/privacy}","received_events_url":"https://api.github.com/users/netwww1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-03-23T09:30:21Z","updated_at":"2016-12-09T15:39:00Z","closed_at":"2016-12-09T15:39:00Z","body":"Tested in 'sample in bootstrap v3' demo / version 2.3.8\nbrowser: chrome 49.0.2623.87m\nos: win7 64bit\n\nWhen 1st click, 'show' function run ' this.picker.show(); ', which change 'display' from 'none' to 'block', and widths of some divs are recalculated. Then the code 'offset = this.component.offset();' in 'place' function get wrong 'left'. \n\nMy fixed code is:\n\n``` js\n      if (this.picker) {\n        var disp = this.picker.css('display');    // save the value of 'display'\n        this.picker.hide();    // hide before get offset\n      }\n      if (this.component) {\n        offset = this.component.offset();\n        left = offset.left;\n        if (this.pickerPosition == 'bottom-left' || this.pickerPosition == 'top-left') {\n          left += this.component.outerWidth() - this.picker.outerWidth();\n        }\n      } else {\n        offset = this.element.offset();\n        left = offset.left;\n        if (this.pickerPosition == 'bottom-left' || this.pickerPosition == 'top-left') {\n          left += this.element.outerWidth() - this.picker.outerWidth();\n        }\n      }\n      if (this.picker) {\n        this.picker.css('display', disp);    // recover 'display'\n      }\n```\n\n![picker](https://cloud.githubusercontent.com/assets/17537636/13981042/9e468190-f11c-11e5-934b-4d43bbe0a3c2.png)\n"}}
{"actor":{"display_login":"AuspeXeu"}}