绝对定位一个二维码图像在顶部右侧

<div style="position:absolute;right:10px;top:10px;background-color:#fff;" id="weixin">
			<div style="font-weight:900;">关注官方微信</div>
			<img src="/images/weixin.jpg" width="120" height="120">
		</div>
		<script>
		var change_weixin_time	=	setInterval("change_weixin_pos();",500);
		function change_weixin_pos()
		{
			var winWidth = document.body.clientWidth;
			//alert(winWidth);
			if(winWidth>1266)
			{
				var right_width	=	((winWidth-1000)/2-133);
				//right_width=170;
				document.getElementById("weixin").style.right = right_width+'px';
			}
			else
			{
 
				if(winWidth>1000)
				{
					var right_width	=	(winWidth-1000)/2;
					document.getElementById("weixin").style.right = right_width+'px';
				}
			}
		}
		</script>

Related posts:

Leave a Reply

Your email address will not be published.