0
嘗試將autocomplete的翻轉位置放置在輸入右側2個像素處。庫。位置使我能夠將值設置爲「正確」,「左」,...還添加像素right+1
。。位置自動完成
但是,如果我加上像right-2
一樣的翻蓋完全移動到左邊。我不是JavaScript代碼,需要一些幫助。
這是JavaScript代碼
function html_entity_decode(b){var a=document.createElement("textarea");a.innerHTML=b.replace(/</g,"<").replace(/>/g,">");return a.value}$.extend({getUrlVars:function(){var d=[],c;var a=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var b=0;b<a.length;b++){c=a[b].split("=");d.push(c[0]);d[c[0]]=c[1]}return d},getUrlVar:function(a){return $.getUrlVars()[a]}});$.widget("custom.catcomplete",$.ui.autocomplete,{_renderMenu:function(d,c){var b=this,a="";$.each(c,function(e,f){if(f.category!=a){f.category=html_entity_decode(f.category);d.append("<li class='ui-autocomplete-category'>"+f.category+"</li>");a=f.category}f.label=html_entity_decode(f.label);f.desc=html_entity_decode(f.desc);b._renderItem(d,f)})}});$(function(){$("#searchbox").catcomplete({source:function(c,a){c.term=escape(c.term);var b=$.getJSON("autocomplete.php",c,function(e,d,f){a(e)})},minLength:2,delay:200,position:{my:"right top",at:"right-2 bottom", collision:"flip horizontal"},highlight:true,select:function(b,c){var a=$.getUrlVar("XTCsid");if(a!=null){var d="?";if(c.item.link.indexOf("&")!=-1){d="&"}a=d+"XTCsid="+a}else{a=""}location.href=c.item.link+a;return false}}).data("catcomplete")._renderItem=function(b,d){var f="";if(d.desc!=null&&d.desc!=""){f="<div class='short_desc'>"+d.desc+"</div>"}var e="";if(d.image!=null&&d.image!=""){e="<div class='prod_img'><img src='"+d.image+"' /></div>"}var c="";if(d.price!=null&&d.price!=""){c="<div class='prod_preis'>"+d.price+"</div>"}var a="";if(d.label!=null&&d.label!=""){a="<div class='prod_name'>"+d.label+"</div>"}return $("<li></li>").data("item.autocomplete",d).append("<a><div class='prod_komplett'>"+e+a+f+c+"</div></a>").appendTo(b)}});
的位置的部分是這裏
position:{my:"right top",at:"right-2 bottom", collision:"flip horizontal"
問候
非常感謝你。我沒有看到該行偏移..歡呼 – karabey