css active
css的active属性在安卓和ios上是不兼容的,苹果手机是识别不了的,
可以用js的鼠标移入事件或者定义以下:
var a = document.getElementsByTagName('a');
for(var i = 0; i < a.length; i++)
{
a[i].addEventListener('touchstart',function(){},false);
}
即可
css的active属性在安卓和ios上是不兼容的,苹果手机是识别不了的,
可以用js的鼠标移入事件或者定义以下:
var a = document.getElementsByTagName('a');
for(var i = 0; i < a.length; i++)
{
a[i].addEventListener('touchstart',function(){},false);
}
即可
text-overflow:ellipsis;
white-space:nowrap;
overflow:hidden;
text-overflow是否显示省略标记。并不具备其它的样式属性定义。要实现溢出时产生省略号的效果。还必须定义:强制文本在一行内显示(white-space:nowrap)及溢出内容为隐藏(overflow:hidden)。只有这样才能实现溢出文本显示省略号的效果。
一、仅定义text-overflow:ellipsis; 不能实现省略号效果。
二、定义text-overflow:ellipsis; white-space:nowrap; 同样不能实现省略号效果
三、同时应用: text-overflow:ellipsis; white-space:nowrap; overflow:hidden; 可实现所想要得到的溢出文本显示省略号效果:
手机屏幕同样有效
function wapWeb(){
document.write(
"屏幕分辨率为:"+screen.width+"*"+screen.height
"屏幕可用大小:"+screen.availWidth+"*"+screen.availHeight
"网页可见区域宽:"+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.screenTop
"网页正文部分左:"+window.screenLeft
"屏幕分辨率的高:"+window.screen.height
"屏幕分辨率的宽:"+window.screen.width
"屏幕可用工作区高度:"+window.screen.availHeight
"屏幕可用工作区宽度:"+window.screen.availWidth
);
}
一、如果已知div的高度(未知的话用js获取此div的有效高度),js获取手机屏幕高度,计算出向上的距离,可用position或者margin-top实现
function getHeight(){
var phoneHeight = screen.height;
var div = document.body.clientHeight;//未知div时求得的高度,别忘去掉 px
var height = (phoneHeight-300)/2;//已知高度是300
height = Math.floor(height);//取整
$('.div').css('margin-top',height);
}getHeight();
二、用定位实现:先计算出div的高度(XX为此div高度的一半)
left:50%;
top:50%;
margin-left:-XXpx;
margin-top:-XXpx;