【发布时间】:2012-02-03 00:45:07
【问题描述】:
我正在尝试找出一种在设备旋转时使用 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-->
然后是orientationchange事件:
$(window).bind( 'orientationchange', function(e){
var newWidth = $(window).width();
$('.message-entry').css({'width':newWidth + 'px'});
});
有什么想法吗?谢谢!
【问题讨论】:
标签: javascript jquery css jquery-mobile