Is possible to do something like: when the browser is resized I dont' want to alterate width and height to any element of body. I hava a large table in my page and when I resize I want to have the same width or height as when was loaded in full browser mode.
just give your table a fixed width and height. With min-width and min-height it will still resize untill it matches the defined minimum width and height
table
{
width:500px;
}
the width might not be a problem but you never know the height of a table, this can change a lot so with jQuery you can do the following:
var myTable = $('.table');
var myTableHeight = myTable.height();
myTable.css('height', myTableHeight);
EDIT: Based on your comment this is what you could do. You leave the 200% but the first time the browser loads you get the width of the table and set it as fixed width. It will then always stay the same.
<script type="text/javascript">
$(document).ready(function() {
//once the document was completely loaded get the width of the table and se it as fixed width
var myTable = $('.table');
var myTableWidth = myTable.width();
myTable.css('width', myTableWidth);
});
</script>
使用CSS min-width
和min-height
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.