Giúp widget cần thiết luôn xuất hiện trên màn hình & tiết kiệm vị trí website.

<style type='text/css'>
#gb{
position:fixed;
bottom:5px;
z-index:+1000;
}
* html #gb{position:relative;}
.gbtab{
height:100px;
width:74px;
float:left;
cursor:pointer;
background:url('http://ca0.upanh.com/13.629.17846849.9nR0/code1kcomkecil.jpg') no-repeat;
}
.gbcontent{
float:left;
background:none;
padding:3px;
}
</style>
<script type='text/javascript'>
function showHideGB(){
var gb = document.getElementById("gb");
var w = gb.offsetWidth;
gb.opened ? moveGB(0, 75-w) : moveGB(71-w, 0);
gb.opened = !gb.opened;
}
function moveGB(x0, xf){
var gb = document.getElementById("gb");
var dx = Math.abs(x0-xf) > 10 ? 5 : 1;
var dir = xf>x0 ? 1 : -1;
var x = x0 + dx * dir;
gb.style.right = x.toString() + "px";
if(x0!=xf){setTimeout("moveGB("+x+", "+xf+")", 10);}
}
</script>
<div id='gb'>
<div class='gbtab' onclick='showHideGB()'>
</div>
<div class='gbcontent'>
<object data='http://assets.mixpod.com/swf/mp3/minime.swf' height='68' style='width:160px;height:68px' type='application/x-shockwave-flash' width='160'><param name='movie' value='http://assets.mixpod.com/swf/mp3/minime.swf'/><param name='quality' value='high'/><param name='scale' value='noscale'/><param name='salign' value='TL'/><param name='wmode' value='transparent'/><param name='flashvars' value='myid=64026113&path=2010/08/16&mycolor=2698cc&mycolor2=f7fbff&mycolor3=000000&autoplay=false&rand=0&f=4&vol=100&pat=0&grad=false'/></object>
</div></div>
<script type='text/javascript'>
var gb = document.getElementById("gb");
gb.style.right = (75-gb.offsetWidth).toString() + "px";
</script>
1 nhận xét:
- Có cách nào nhận bài viết qua email không bạn ?
Đăng nhận xét