这个流星客户端代码试图给人一个按钮被点击的印象。它使用onmousedown
事件将类应用于div
,但它在检查浏览器元素选项卡时不应用该类。
它有什么问题?由于模拟按钮点击印象
Template.footer.events({
'click .footerItem': function(event) {
//do some stuff here
},
'onmousedown .footerItem': function(event) {
$(event.target).addClass('inset');
},
'onmouseup .footerItem': function(event) {
$(event.target).removeClass('inset');
}
});
.inset {
box-shadow: inset 2px 2px 6px #999;
}
.footer-row {
text-align: justify;
background-color: white;
}
<template name="footer">
<footer class="footer-row">
{{#each footerButtons}}
<div class="footerItem" data-action={{this.action}}>{{this.label}</div>
{{/each}}
</footer>
</template>