.footer-menu-container .header-panel .search { text-align: right; }
.footer-menu-container .header-panel .search input.search-txt
{
width: 180px;
font-size: 1.1em;
margin: 0;
padding: 2px 8px;
border-radius: 4px 0 0 4px;
border: 1px solid #9fbee2;
height: 24px;
-webkit-transition-duration: 400ms;
-moz-transition-duration: 400ms;
-o-transition-duration: 400ms;
transition-duration: 400ms;
-webkit-transition-property: width, background;
-moz-transition-property: width, background;
-o-transition-property: width, background;
transition-property: width, background;
-webkit-transition-timing-function: ease;
-moz-transition-timing-function: ease;
-o-transition-timing-function: ease;
transition-timing-function: ease;
}
.footer-menu-container .header-panel .search input.search-txt:focus
{
background-color: #f5f5f5;
width: 300px;
}
.footer-menu-container .header-panel .search .search-btn
{
float: right;
width: 32px;
min-width: 34px;
height: 30px;
background: transparent url(‘/persist/img/search-icon.png’) no-repeat scroll 2px 50%;
border-radius: 0 4px 4px 0;
-webkit-box-shadow:0 0 0 #cccccc;
-moz-box-shadow: 0px 0px 0px #cccccc;
box-shadow:0 0 0 #cccccc;
border: 1px solid #9fbee2;
border-left: 0;
background-color: #dbecff;
}
” + “”);
that.currentCategory = item.category;
dirCssClass = (dirCssClass === ”) ? ‘ right’ : ”;
}
that._renderItem(ul, item);
cnt++;
});
if (cnt > 0) { ul.append(“” + “” + “”); }
},
_renderItem: function (ul, item) {
var term = this.term;
var formattedLabel = item.description.replace(new RegExp(‘(‘ + term + ‘)’, ‘ig’), function ($1, match) { return ” + match + ”; });
var t = (item.typeName) ? item.typeName : ” “;
t = (item.typeUrl) ? “” + t + “” : t;
return $(“”)
.data(“item.autocomplete”, item)
.append(“” + ((item.tag1) ? item.tag1 : ” “) + “” + ((item.tag2) ? item.tag2 : ” “) + “” + “” + t + “”)
.appendTo(ul);
}
});
$(“#ctl00_ctlFooterMenu_ctlSearch_txtSearch”).catcomplete({
delay: 2000,
minLength: 2,
html: true,
position: { my: “right top”, at: “right bottom+1”, of: “#ctl00_ctlFooterMenu_ctlSearch_btnSearch”, collision: “none” },
appendTo: ‘div.page’,
source: function (request, response) {
var term = request.term.toLowerCase(),
element = this.element,
cache = this.element.data(‘autocompleteCache’) || {},
queue = this.element.data(‘autocompleteQueue’) || {};
if (term in cache || term in queue) {
response(cache[term]);
return;
}
console.log(“Ajax call.”);
$.ajax({
url: ‘/Ajax/Search/AutoComplete.aspx’,
dataType: “json”,
data: { q: request.term },
success: function (data) {
cache[term] = data;
element.data(‘autocompleteCache’, cache);
delete queue[term];
element.data(‘autocompleteQueue’, queue);
response(data);
}
});
},
select: function (event, ui) {
if (!ui.item) { return; }
if (ui.item.exact) {
window.location.href = ui.item.href;
return;
}
else {
if (ui.item.value === ‘close’) { $(“#ctl00_ctlFooterMenu_ctlSearch_txtSearch”).autocomplete(“close”); }
else { window.location.href = ‘/Search/’ + ‘?q=’ + ui.item.value; }
}
},
open: function (event, ui) { /* $(this).catcomplete(‘widget’).width(‘800px’); */ },
close: function (event, ui) { }
});
$(‘#ctl00_ctlFooterMenu_ctlSearch_btnSearch’).click(function(){
var _text = $(“#ctl00_ctlFooterMenu_ctlSearch_txtSearch”).val();
if (_text.length > 2) window.location.href = ‘/Search/’ + ‘?q=’ + _text;
return false;
});
}); LEGGI TUTTO