工作中遇到问题的解决办法

iframe里面的video,无法全屏:需要添加 allowfullscreen="true"。

<iframe height='600px' width='600px' src='video.html' frameborder='0' webkitallowfullscreen="true" mozallowfullscreen="true" msallowfullscreen="true" 
allowfullscreen="true"></iframe>

内联样式自动出现,一般是js控制写入的

1.enter或submit按钮提交表单:form标签内写onsubmit="return false";input type="submit";提交语句,form的submit事件,$("#form_id").submit()。

button提交表单:input type="button";提交语句,button的click事件,$("#button_id").click();

2.ie8设置透明度后,文字也变透明了---解决办法:http://www.cnblogs.com/PeunZhang/p/4089894.html

3.IE部分浏览器不支持background-size---解决办法:http://blog.csdn.net/auphiria/article/details/45221317

4.使用jquery的animate方法控制元素移动,需要将元素的位置定义为relative, fixed或者 absolute。

$("#div_id").animate({"left":"250px","top":"100px"});

5.页面自适应高度的jquery算法:

//父高度
var parentHeight = $("#parent").height();

//兄弟高度
var siblingHeight = 0;
$("#self").siblings().each(function(){
siblingHeight += $(this).outerHeight(true);
});
//自已的其它高度,视具体情况,没值的时候,可删除
var selfOutHeight = $("#self").outerHeight(true) - $("#self").height();

//最后结果
$("#self").height(parentHeight - (siblingHeight+selfOutHeight));

 6.图片渐现效果,使用jquery的animate改变透明度:从透明度0.2到0.8,用2秒时间

$("#div_id").css("opacity","0.2").animate({"opacity":"0.8"},2000);

 7.在写单页面应用spa时,一个页面中有多个不同z-index的div,如何保证div的滚动不会影响其他的div,加入如下样式:

html,body {
    height:100%;
    overflow:auto;
}
原文地址:https://www.cnblogs.com/cag2050/p/5609079.html