-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlingulo-select.min.js
More file actions
1 lines (1 loc) · 1.06 KB
/
lingulo-select.min.js
File metadata and controls
1 lines (1 loc) · 1.06 KB
1
/*Lingulo Custom Select Boxes (http://www.lingulo.com)*/(function(e,t,n,r){"use strict";var i={init:function(){var t=e("select");i.buildHTML();t.each(function(t,n){var r=e(this);r.prev().on("click",function(){var t=r.children("option");i.showList(t,e(this));i.chooseElement(e(this))})})},showList:function(e,t){var n="<ul>";e.each(function(e,t){n+="<li><span>"+t.innerHTML+"</span></li>"});n+="</ul>";t.parent().parent().addClass("showit");t.parent().next(".lg-options").html(n)},chooseElement:function(t){t.parent().next(".lg-options").find("li").on("click",function(){t.parent().parent().removeClass("showit");var n=e(this).eq(0);t.html("<i class='fa fa-angle-double-right'></i>"+n.text());i.setSelectBox(e(this),t)})},setSelectBox:function(e,t){var n=e.index();var r=t.next("select").children("option").eq(n);t.next("select").children("option").removeAttr("selected");r.attr("selected","selected")},buildHTML:function(){e(".lg-select").wrap("<div class='lingulo-select'></div>");e(".lg-select").after("<div class='lg-options'></div>")}};e(function(){i.init()})})(jQuery,window,document)