Skip to content

Instantly share code, notes, and snippets.

View s0ber's full-sized avatar

Sergey Shishkalov s0ber

View GitHub Profile
$.extend($.Autocompleter.prototype, {
position: function() {
var offset = this.dom.$elem.offset();
this.dom.$results.css({
bottom: Plca.view.partials.$body.height() - offset.top,
left: offset.left
});
},
cloneFunc: function(func) {
var temp = function() {
var suggest = target
.autocomplete({
...
}) // Инициализируем у инпута автокомплит с набором параметров
.data('autocompleter'); // Сохраняем в переменную suggest объект автокомплита сохраненный в data атрибуте autocompleter за счет чейнинга
// Изменяем поведение метода position на нужное
suggest.position = function() {
var offset = this.dom.$elem.offset();
this.dom.$results.css({
# The main rule: I want to see a method call. Brackets are the most simple way to make it.
# if there is single argument and it is not a string, brackets required
fn()
fn(1)
fn(variable)
# if just single string, quotes are some kind of brackets here, and brackets can be omitted
fn 'string'