最近在做一个鼠标移入移出图片事件,有几种方法大家可以试一下 首先是改变分辨率的两种方法,鼠标移入图片和移出图片的分辨率不同 方法一 代码如下: 图片列表:鼠标移入/移出改变图片透明度 ul,li{margin:0;padding:0;list-style-type:none;} #imgList{width:700px;overflow:hidden;zoom:1;border:1px solid #333;margin:0 auto;padding:0 0 10px 10px;} #imgList li{float:left;width:128px;height:128px;border:1px solid #...
DIV:代码如下: ${pic.desc}${pic.poi}by ${pic.username} CSS:代码如下:.pic_conent{height: 720px;/*这个高度会被js改掉*/text-align: center;display: table-cell;vertical-align: middle;}.pic_layer{text-align:center; width:100%; display:inline-block; vertical-align:middle;} jquery:代码如下:$(function() {var surH = $(window).height();$(".pic_conent").height(surH);window.onresize=function(){var surH = $(w...
网页可见区域宽: document.body.clientWidth 网页可见区域高: document.body.clientHeight 网页可见区域宽: document.body.offsetWidth (包括边线的宽) 网页可见区域高: document.body.offsetHeight (包括边线的高) 网页正文全文宽: document.body.scrollWidth 网页正文全文高: document.body.scrollHeight 网页被卷去的高: document.body.scrollTop 网页被卷去的左: document.body.scrollLeft 网页正文部分上: window.sc...
检测屏幕宽度,并设置为id为frame的div宽度, 根据自己网页的最大宽度来调节,小demo最大宽度为1440 代码如下: 无标题文档 function onWidthChange(){ var w=$(window).width(); x=(w-1440)/2; $("#frame").css("width",w); if(w$("#frame").css("overflow","visible"); $("#webContent").css("margin-left",x); }else if(1024$("#frame").css("overflow","hidden"); $("#webContent").css("margin-left",x); } setTimeout(...
效果如下:代码如下:获取当前对象大小以及屏幕分辨率等var s = ""; s += " 网页可见区域宽:"+ document.body.clientWidth+""; s += " 网页可见区域高:"+ document.body.clientHeight+""; s += " 网页可见区域宽:"+ document.body.offsetWidth + " (包括边线和滚动条的宽)"+""; s += " 网页可见区域高:"+ document.body.offsetHeight + " (包括边线的宽)"+""; s += " 网页正文全文宽:"+ document.body.scrollWidth+""; ...
手机的屏幕有大有小,移动web最好做成响应式布局,也就是自适应屏幕,没有固定宽高,这样的话,在所有手机上都可以正常显示。关于移动端页面按手机屏幕分辨率自动缩放的js,先附上代码 <script>var phoneWidth = parseInt(window.screen.width);var phoneHeight = parseInt(window.screen.height);var phoneScale = phoneWidth/750;//除以的值按手机的物理分辨率var ua = navigator.userAgent;if (/Android (\d+\.\d+)/.test(ua)) ...
实例如下: <script type="text/javascript">var ObjImg = jQuery(".Dy_Content img");for (var i = 0; i < ObjImg.length; i++) {loadImage(ObjImg.eq(i));}function loadImage(Obj) {var b_width = 320;var img = new Image();img.src = jQuery(Obj).attr("src");if (img.complete) {var i_width = img.width;var i_height = img.height;if (i_width > b_width) {var bx = b_width / i_width;jQuery(Obj).width(b_width);jQuery(...
效果如下:代码如下:<html> <head> <title>获取当前对象大小以及屏幕分辨率等</title> <body> <div style=" width:88%;margin:30px auto; color:blue;" id="div_html"> </div> <script type="text/javascript"> var s = ""; s += " 网页可见区域宽:"+ document.body.clientWidth+"<br />"; s += " 网页可见区域高:"+ document.body.clientHeight+"<br />"; s += " 网页可见区域宽:"+ document.body.offsetWidth + " (包括边...
检测屏幕宽度,并设置为id为frame的div宽度, 根据自己网页的最大宽度来调节,小demo最大宽度为1440 代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <script src="js/jquery.min....
网页可见区域宽: document.body.clientWidth 网页可见区域高: document.body.clientHeight 网页可见区域宽: document.body.offsetWidth (包括边线的宽) 网页可见区域高: document.body.offsetHeight (包括边线的高) 网页正文全文宽: document.body.scrollWidth 网页正文全文高: document.body.scrollHeight 网页被卷去的高: document.body.scrollTop 网页被卷去的左: document.body.scrollLeft 网页正文部分上: window.sc...
DIV:代码如下:<div class="pic_conent"><div class=" fn-pr pic_layer"><!--图片文字介绍透明层--><section class="bg text_layer_home p10 font-yahei fn-bc"> <h2 class="f14 fefefe">${pic.desc}</h2><aside class="f12 bbb"><c:if test="${not empty pic.poi}"><span class="scenery fn-fl">${pic.poi}</span></c:if><span class="fn-fr mt10">by ${pic.username}</span></aside></section><img src="${pic.picUrl}" width=...
最近在做一个鼠标移入移出图片事件,有几种方法大家可以试一下 首先是改变分辨率的两种方法,鼠标移入图片和移出图片的分辨率不同 方法一 代码如下:<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>图片列表:鼠标移入/移出改变图片透明度</title> <style> ul,li{margin:0;padding:0;list-style-type:none;} #imgList{width:700px;overflow:h...
在做页面时,用户要求,不同的分辨率,弹出窗口的位置不同,我想是不是先获得屏幕宽度,然后付值给变量,再在onclick中设置参数 代码如下:<script> alert(screen.width+"*"+screen.height) </script> 代码如下:<script> function centerWindow(url,w,h){ l=(screen.width-w)/2 t=(screen.height-h)/2 window.open(url,,left=+l+,top=+t+,width=+w+,height=+h) } </script> <input type=button onclick="centerWindow(about:blan...
如何用JS特效显示自己的屏幕分辨率以及屏幕尺寸呢?请看下面一段代码: 代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>JS测试显示器分辨率</title> </head> <body> <div style="width:1cm;" id="hu...
贴代码 代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>弹出窗口_www.gxlcms.com</title> <link type="text/css" rel="stylesheet" href="window.css"> <script language="javascript" type="text/ja...