Skip to content

Instantly share code, notes, and snippets.

@anasnakawa
Last active December 11, 2015 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anasnakawa/4646950 to your computer and use it in GitHub Desktop.
Save anasnakawa/4646950 to your computer and use it in GitHub Desktop.
overriding bootstrap typeahead to perform in rtl pages
// overriding typeahead
!function ($, biStrap) {
"use strict"
// defining standard namespace to wrap original bootstrap
// methods that needs to be overridden
biStrap.typeahead.show = $.fn.typeahead.Constructor.prototype.show;
$.fn.typeahead.Constructor.prototype.show = function(){
biStrap.typeahead.show.apply(this, arguments);
var pos = /*$.extend({}, */this.$element.offset()/*, {
height: this.$element[0].offsetHeight
})*/
this.$menu.css({
/*top: pos.top + pos.height
,*/ right: $(window).width() - pos.left - this.$element.outerWidth()
, left: 'auto'
})
/*this.$menu.show()*/
this.shown = true
return this
}
} ( window.jQuery,
$.fn.biStrap = $.fn.biStrap || {},
$.fn.biStrap.typeahead = {} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment