// some scripts var menu_loadCatDone = []; function menu_loadCat(id) { if (menu_loadCatDone[id]) return; $("#menu_cat"+id).load("/html/menu_categories.php?parent="+id, function() {}); menu_loadCatDone[id] = true; } // jquery ready start $(document).ready(function() { // jQuery code /* /////////////////////////////////////// THESE FOLLOWING SCRIPTS ONLY FOR BASIC USAGE, For sliders, interactions and other */ /////////////////////////////////////// //////////////////////// Prevent closing from click inside dropdown $(document).on('click', '.dropdown-menu', function (e) { e.stopPropagation(); }); //////////////////////// Bootstrap tooltip if($('[data-toggle="tooltip"]').length>0) { // check if element exists $('[data-toggle="tooltip"]').tooltip() } // end if $('.zoom').magnify(); $(function() { $( "#q" ).autocomplete({ source: function( request, response ) { $.ajax({ url: "/searchJSON.php",dataType:"json",data:{q:request.term}, success: function( data ) { response($.map( data.products, function( item ) { return { label:item.name, value:item.name} })); } }); }, minLength: 2, open: function() { $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" ); }, close: function() { $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" ); } }) .keydown(function(e){ if (e.keyCode === 13) { $("#search").trigger('submit'); } }); }); }); // jquery end