2013年9月11日 星期三

jquery-resize auto-height auto height example sample eg e.g.

jquery-minwidth min-width
show height show-height

<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<style type="text/css">
#browserInfo{padding:8px;border:1px solid blue;width:30%;}
</style>
 </head>
<body>
<h1>jQuery resize() example</h1>
<h4>Try resize this browser</h4>
<div id="browserInfo">
</div>



<script type="text/javascript">
$(window).resize(function () {
        resizeElements()
    });
    function resizeElements(){
  if ($(window).width()<=800)
{$( "#browserInfo" ).css('width','240px'); } else //set min-width
{$( "#browserInfo" ).css('width','30%'); }
$('#browserInfo').text('Browser (Width : ' +
$(window).width() + ' , Height :' +
$(window).height() + ') this width '+$("#browserInfo").width()+" -- ");
}
$(function () {
resizeElements();})
</script>


</body>
</html>

沒有留言:

張貼留言