Thứ Hai, 4 tháng 8, 2014

css + java script full màn hình

<!DOCTYPE >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" src="http://ajax.Microsoft.com/ajax/jQuery/jquery-1.7.1.min.js"></script>
<title>Untitled Document</title>
<style type="text/css">
* {
    margin:0;
    padding:0;
}
html {
    overflow: hidden;
}
.imgbg {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}
</style>
<script language="javascript">
$(document).ready(function() {
var $winwidth = $(window).width();
$("img.my_image").attr({
    width: $winwidth
});
$(window).bind("resize", function(){
    var $winwidth = $(window).width();
    $("img.my_image").attr({
        width: $winwidth
    });
 });
 });
</script>
</head>

<body>
<img class="my_image" src="1.png" />
</body>
</html>

Không có nhận xét nào:

Đăng nhận xét