framework7io / framework7

Full featured HTML framework for building iOS & Android apps
http://framework7.io
MIT License
18.04k stars 3.23k forks source link

[Feature request] Prevent close element cordova back button #4147

Closed Simone4e closed 1 year ago

Simone4e commented 1 year ago

It would be useful to be able to block the back button when in the element (e.g. popup) it has the parameter "don't close" (e.g. in the popup it is closeByBackdropClick or closeOnEscape

So you should add to the Cordova file:

document.addEventListener(
      'backbutton',
      function (e) {
      if ($('.popup.modal-in').length) {
          if ($('.popup.modal-in>.view').length) {
              //if this popup has this parameter 
              e.preventDefault();
              return false;
             //else ...

          }
     }
});
nolimits4web commented 1 year ago

This is a custom script file, you can for sure just modify that file according to your needs

Simone4e commented 1 year ago

It's not a custom script just a basic usage, if I have closeByBackDrop false I want to denied close from all source included cordova back button