Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何使用相同的热键关闭?_Jquery_Html_Angularjs_Angularjs Directive_Angularjs Scope - Fatal编程技术网

Jquery 如何使用相同的热键关闭?

Jquery 如何使用相同的热键关闭?,jquery,html,angularjs,angularjs-directive,angularjs-scope,Jquery,Html,Angularjs,Angularjs Directive,Angularjs Scope,我在我的网站中使用代码作为快捷方式,现在我如何使用相同的热键关闭该块 我的街区是个狭长地带, 我在我的页面中使用了3个边距,顶部、底部和右侧 我使用下面的代码,使用F1打开边线,现在我如何使用相同的键关闭边线 keyboardManager.bind('f1',function(){ $aside({scope:$scope,模板:'aside/passenger.tpl.html',show:true}); });我不确定您是如何设置代码的,但我会这样做: var shown = false

我在我的网站中使用代码作为快捷方式,现在我如何使用相同的热键关闭该块

我的街区是个狭长地带, 我在我的页面中使用了3个边距,顶部、底部和右侧 我使用下面的代码,使用F1打开边线,现在我如何使用相同的键关闭边线

keyboardManager.bind('f1',function(){
$aside({scope:$scope,模板:'aside/passenger.tpl.html',show:true});

});我不确定您是如何设置代码的,但我会这样做:

var shown = false;

keyboardManager.bind('f1', function() {
    $aside({scope: $scope, template: 'aside/passenger.tpl.html',show: !shown});
});
其思想是,不是指定“show”应该为true,而是每次按“f1”时反转show的值。通过这种方式,您可以重复使用绑定热键,每次使用它时,它都会死掉