我正在试图弄清楚如何"动画"悬停元素的孩子.如何让它在多个浏览器中运行如此复杂?
什么是最佳做法?
.parent {
-moz-transition:-moz-transform 180ms;
-webkit-transition:-webkit-transform 180ms;
-o-transition:-o-transform 180ms;
transition:transform 180ms;
}
.parent:hover > .child {
transform: translate(0,-42px);
}
Run Code Online (Sandbox Code Playgroud)
http://jsfiddle.net/KKrdA/2/ 在firefox
或
.parent {
-moz-transition:top 180ms;
-webkit-transition:top 180ms;
-o-transition:top 180ms;
transition:top 180ms;
}
.parent:hover > .child {
top:-42px;
}
Run Code Online (Sandbox Code Playgroud)
http://jsfiddle.net/KKrdA/1/ 适用于webkit浏览器
我已经尝试通过阅读它来了解this关键字所指的内容.好吧,那没有帮助.所以请帮我这个!
手动函数调用与事件监听器绑定的区别在哪里?
var app = {
foo: true,
bar: function() {
console.log("this",this.foo);
console.log("app",app.foo);
}
}
app.bar();
/* this true
app true */
document.addEventListener("click", app.bar);
/* this undefined
app true */
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助