Question

I’ve gone over the nyroModal documentation and Google, but cannot find a simple solution to my issue.

I have attached the nyroModal to some buttons:

$('.modal:not(.disabled)').nm();

Now, the problem I’m having, is that in some cases I need to disable the modal from opening if the button is disabled, but the disabled class is added on the fly. But as the nmObject is added to the selector on DOM ready, the nmObject ignores this class and still fires.

The nyromodal documentation does not have a disable or prevent method that I could fire in the "beforeShowBg" callback.

Anyone have any suggestions?

Was it helpful?

Solution

You could handle the event click of the button and use the manual function according to your needs. So you could add also some conditions to run nyromodal.

$('#mybutton').click(function(){
    // ...                
    $.nmManual('http://someurl.com/', {
        callbacks: { 
                initFilters: function(nm) {
                nm.filters.push('link');
                nm.filters.push('iframe');
            }
        }
    });    
    // ...
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top