Created
April 18, 2013 15:49
-
-
Save a-ignatov-parc/5413810 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.extend(typeahead, { | |
| show: function() { | |
| var targetOffset = this.$element.offset(), | |
| targetHeight = this.$element.outerHeight(), | |
| containerOffset = container.offset(); | |
| // Корректируем позиционирование | |
| targetOffset.top -= containerOffset.top; | |
| targetOffset.top += targetHeight; | |
| targetOffset.left -= containerOffset.left; | |
| targetOffset.left -= 15; | |
| // Если мы еще не создавали контейнер, то делаем это и апендим внутрь блок $menu | |
| if (!this.$popup) { | |
| this.$popup = $('<div class="b-popup"></div>').append(this.$menu); | |
| } | |
| // Апендим контейнер в нужное место, позиционируем и делаем видимым | |
| this.$popup | |
| .appendTo(container) | |
| .css(targetOffset) | |
| .show(); | |
| this.shown = true; | |
| return this; | |
| }, | |
| hide: function() { | |
| this.$popup.hide(); | |
| this.shown = false; | |
| return this; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment