0

I'm currently experiencing a problem with Bootstrap Modal, when changing views through the URL. ReloadOnSearch is disabled.

If I'm on a view such as:

blah.com/examples/1

and open up a Modal with a faded backdrop, then change the URL to change views such as:

blah.com/examples/2

the Modal window will close, but the faded backdrop will remain, and disable interaction to the web page.

I'm wondering if there is a way to define one function, which will programmatically remove the faded backdrop, which will execute on URL change, regardless of the controller in use.

Though the cause of the issue is due to AngularJS, the solution doesn't need to use AngularJS.

1
  • I had same issue, the solution is to remove that overlay class while your hashurl change Commented Sep 15, 2015 at 11:10

2 Answers 2

2

I had same issue, the solution is to remove that overlay class while your hashurl change

    window.onhashchange = function() {
    $(".lean-overlay").fadeOut(500); // whatever class name your overlay has
     }
Sign up to request clarification or add additional context in comments.

1 Comment

Worked like a charm. Didn't realise there was a 'onhashchange' event!
1

Use the event onhashchange to hide all modals on screen using the proper hide method:

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);
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.