2014-06-12 106 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