2014-06-12 216 views
1

我在我的應用程序中使用jQuery移動1.4.2。文本區域滾動條存在問題,即滾動條可見。我們如何啓用滾動條視圖。我需要與以下鏈接中的滾動條相似的文本區域。問題與文本區域滾動條?

http://www.askthecssguy.com/examples/scrollingbox/

我的代碼如下,

HTML:

<div data-role="page" id="privacy_details"> 
    <div data-theme="a" data-role="header"> 
     <h3> 
      Privacy Policy 
     </h3> 
    </div> 

    <div data-role="content"> 
     <div data-role="fieldcontain"> 
      <textarea class="txtarea" style="resize: none;"> 
data 
data 
data 
data 
data 
data 
data 
data 
data 
data 
data 
data 
data 
data 
      </textarea> 

      <a href="#" data-rel="back" data-role="button" data-theme="c" target="_blank">OK</a> 
     </div> 
    </div> 
</div> 

CSS:

.txtarea { height:300px; max-height: 300px; } 

我的屏幕截圖如下,

enter image description here

+0

保持高度100並檢查 – zzlalani

+0

我試着用高度100px。它不起作用 – Vinod

+0

在你的風格中應用'!important'後高度爲 – zzlalani

回答

1

設置textarea固定height,然後添加data-autogrow="false"以防止其自動增長。

  • CSS

    textarea { 
        height: 150px; /* any value you want */ 
    } 
    
  • HTML

    <textarea data-autogrow="false"> 
    
        <!-- text --> 
    
    </textarea> 
    

Demo

0

嘿你的內聯樣式將被覆蓋。你需要添加一個類或id到你的textarea並在你的css文件中設置它。

.txtarea { 

max-height:100px !important; 
height:100px !important; 
overflow:scroll !important; 

} 

,你需要添加overflow:scroll !important屬性

+0

我已經添加了它仍然不起作用 – Vinod

+0

你添加了類txtarea到你的textarea嗎? –

+0

是的我已經在我的測試網站上添加了 – Vinod