[英]jquery mobile device orientation change not resizing text area
我試圖找出一種在設備旋轉時使用JQM調整文本區域大小的方法。 基本上,我有一個文本區域,在加載時無論是縱向還是橫向都看起來不錯,但是旋轉設備時不會調整大小。 以下是代碼的樣子:
.message-entry{
margin-left:10px;
margin-right:0;
margin-bottom:-20px;
}
和HTML:
<footer data-role="footer" id="footer" data-theme="b" data-position="fixed">
<label class="label-message-entry" for="chatMessageEntry">Enter a message:</label>
<textarea rows="8" name="textarea" class="message-entry" id="chatMessageEntry"></textarea>
<a id="chatReplyButton" class="reply-button" data-role="button" data-icon="plus">Reply</a>
</footer> <!--end footer-->
然后是directionchange事件:
$(window).bind( 'orientationchange', function(e){
var newWidth = $(window).width();
$('.message-entry').css({'width':newWidth + 'px'});
});
有任何想法嗎? 謝謝!
您是否嘗試過在媒體查詢中為textarea設置最小寬度?
@media all and (max-width: 480px) and (min-width: 321px){
.message-entry{
min-width:470px;
}
}
@media all and (max-width: 320px){
.message-entry{
min-width:310px;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.