Javascript 在同一事件上的所有控制器中执行相同的函数-AngularJS
当通过URL更改视图时,我当前遇到引导模式的问题。已禁用重新加载搜索 如果我的观点是: blah.com/examples/1 打开背景褪色的模式,然后更改URL以更改视图,例如: blah.com/examples/2 模式窗口将关闭,但褪色的背景将保留,并禁用与网页的交互 我想知道是否有一种方法可以定义一个函数,该函数将以编程方式删除褪色的背景,该函数将在URL更改时执行,而不考虑正在使用的控制器Javascript 在同一事件上的所有控制器中执行相同的函数-AngularJS,javascript,jquery,angularjs,twitter-bootstrap,Javascript,Jquery,Angularjs,Twitter Bootstrap,当通过URL更改视图时,我当前遇到引导模式的问题。已禁用重新加载搜索 如果我的观点是: blah.com/examples/1 打开背景褪色的模式,然后更改URL以更改视图,例如: blah.com/examples/2 模式窗口将关闭,但褪色的背景将保留,并禁用与网页的交互 我想知道是否有一种方法可以定义一个函数,该函数将以编程方式删除褪色的背景,该函数将在URL更改时执行,而不考虑正在使用的控制器 虽然问题的原因是AngularJS,但解决方案不需要使用AngularJS。使用事件onhas
虽然问题的原因是AngularJS,但解决方案不需要使用AngularJS。使用事件
onhashchange
使用适当的隐藏方法隐藏屏幕上的所有模态:
window.onhashchange = function(event) {
$('.modal').modal('hide');
// You can even add some tests based on the new and old URL
console.log('new URL', event.newURL);
console.log('old URL', event.oldURL);
}
使用事件
onhashchange
使用适当的隐藏方法隐藏屏幕上的所有模态:
window.onhashchange = function(event) {
$('.modal').modal('hide');
// You can even add some tests based on the new and old URL
console.log('new URL', event.newURL);
console.log('old URL', event.oldURL);
}
使用事件
onhashchange
使用适当的隐藏方法隐藏屏幕上的所有模态:
window.onhashchange = function(event) {
$('.modal').modal('hide');
// You can even add some tests based on the new and old URL
console.log('new URL', event.newURL);
console.log('old URL', event.oldURL);
}
使用事件
onhashchange
使用适当的隐藏方法隐藏屏幕上的所有模态:
window.onhashchange = function(event) {
$('.modal').modal('hide');
// You can even add some tests based on the new and old URL
console.log('new URL', event.newURL);
console.log('old URL', event.oldURL);
}
我也有同样的问题,解决方案是在hashurl更改时删除覆盖类
window.onhashchange = function() {
$(".lean-overlay").fadeOut(500); // whatever class name your overlay has
}
我也有同样的问题,解决方案是在hashurl更改时删除覆盖类
window.onhashchange = function() {
$(".lean-overlay").fadeOut(500); // whatever class name your overlay has
}
我也有同样的问题,解决方案是在hashurl更改时删除覆盖类
window.onhashchange = function() {
$(".lean-overlay").fadeOut(500); // whatever class name your overlay has
}
我也有同样的问题,解决方案是在hashurl更改时删除覆盖类
window.onhashchange = function() {
$(".lean-overlay").fadeOut(500); // whatever class name your overlay has
}
我也有同样的问题,解决方案是在hashurl更改时删除覆盖类我有同样的问题,解决方案是在hashurl更改时删除覆盖类我有同样的问题,解决方案是在hashurl更改时删除覆盖类我有同样的问题,解决方案是在hashurl更改工作正常时删除覆盖类。没有意识到有一个“onhashchange”事件!工作得很有魅力。没有意识到有一个“onhashchange”事件!工作得很有魅力。没有意识到有一个“onhashchange”事件!工作得很有魅力。没有意识到有一个“onhashchange”事件!