我尝试停止一个功能,该功能在页面加载后通过按下按钮然后再按下另一个按钮重新激活它,到目前为止我可以重新激活它,但是我无法使用停止按钮我目前的代码。
<button class="play">play</button>
<button class="pause">pause</button>
<div class="scanner-laser">blinking</div>
var blink = (function blink() {
var f = $('.scanner-laser').fadeOut(1000).fadeIn(1000, blink);
})();
$(".play").click(function() {
$('.scanner-laser').fadeOut(1000).fadeIn(1000, blink);
});
$(".pause").click(function() {
f.stop();
blink.die();
});
答案 0 :(得分:1)
# Option 1
# Do some text operations to make the formula based on variables.
if(this==that) {agg_level <- 'week'} else {agg_level <- 'day'}
myFormula <- sprintf("%s ~ city", agg_level)
met <- dcast(metrics, as.formula(myFormula), sum, value.var = metric)
# Option 2 - Untested
# Take advantage of dcast's alternative to the formula notation and pass a list instead.
# No idea if this will work.
met <- dcast(metrics, list(.(agg_level),.(city)), sum, value.var=metric)
var f = '';
var blink = (function blink() {
f = $('.scanner-laser').fadeOut(1000).fadeIn(1000, blink);
})();
$(".play").click(function() {
$('.scanner-laser').fadeOut(1000).fadeIn(1000, blink);
});
$(".pause").click(function() {
f.stop();
blink.die();
});