Autocomplete base

This commit is contained in:
Jiiks 2015-08-25 11:52:10 +03:00
parent b2ee91fd8f
commit 845591bce6
1 changed files with 21 additions and 0 deletions

21
js/autocomplete.js Normal file
View File

@ -0,0 +1,21 @@
$(function () {
$(".channel-textarea-inner textarea").ready(function () {
var availableTags = [
"Kappa",
"4Head"];
$("#tags").on("keydown", function () {
var newY = $(this).textareaHelper('caretPos').top + (parseInt($(this).css('font-size'), 10) * 1.5);
var newX = $(this).textareaHelper('caretPos').left;
var posString = "left+" + newX + "px top+" + newY + "px";
$(this).autocomplete("option", "position", {
my: "left top",
at: posString
});
});
$(".channel-textarea-inner textarea").autocomplete({
source: availableTags
});
});
});