2014-01-17 43 views
0

正在使用phonegap開發與backbone.js windows phone應用程序。當我嘗試使用像這個圖像的自定義選擇框。 Custom selectbox它總是顯示像這樣的默認選擇框Default SelectBox不能使用自定義選擇框使用骨幹js

爲什麼它不顯示自定義選擇框?

我的代碼

HTML:

<select class="custom-select custom-select-smaller no-border" id="lang-select"> 

CSS:

.custom-select { 
-webkit-box-sizing: border-box; 
-moz-box-sizing: border-box; 
box-sizing: border-box; 
background: #fff; 
border: 2px solid #dfdfdf; 
color: #6b6b6b; 
height: 38px; 
font-size: 11px; 
line-height: 38px; 
padding: 0 6px; 
position: relative; 
width: 100% !important; 
display: block !important; 
} 
.custom-select.custom-select-smaller { 
height: 34px; 
line-height: 34px; 
} 
.custom-select.custom-select-smaller:after { 
top: 14px; 
} 
#lang-select{ 
z-index:~1000; 
} 

回答

0

樣式化元素始終是棘手的,不可靠的。

您可能想添加以下的風格讓它在webkit的&火狐

-webkit-appearance: initial; 
-moz-appearance: none; 
appearance: none; 
text-indent: 0.01px; 
text-overflow: ''; 

工作,但它是不可能的(據我所知),使其在IE瀏覽器。如果你想得到一致的結果,請嘗試使用帶有隱藏標籤的ul + li。

或者只是使用像http://adam.co/lab/jquery/customselect/

+0

與源和插件,但不是爲我工作都試過插件。除此之外,當我在選擇框 – Sabarish

+0

中選擇一項時,背景顏色爲綠色(這是Windows Phone中的默認設置),您的代碼不包含向下箭頭的樣式。你應該能夠申請我的CSS後得到一個空框。 (好吧,再次,僅在Chrome和Firefox中)。在這種情況下,您可能希望用您想要的樣式創建另一個元素,而不是嘗試對本機選擇進行樣式設置。 –