• Resolved pjehan

    (@pjehan)


    Hi,

    First thank you for this plugin, really useful.
    However, I had some troubles trying to add an event listener on the download links in order to display a modal before starting the downloading process.
    I had to delete the node elements and re-create them to make it works:

    // Delete and re-create elements to avoid stopImmediatePropagation() issues
    var btnClone = btn.cloneNode(true);
    btn.parentNode.replaceChild(btnClone, btn);

    Would it be possible to fix this by changing lines 32 and 39 in somdn_script.js with e.preventDefault() instead of e.stopImmediatePropagation()?

    Thanks again for this plugin,

    Pierre Jehan

    • This topic was modified 4 years, 10 months ago by pjehan.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Richard Webster

    (@rwebster85)

    Hi mate. It was a conscious decision to use that function rather than your suggestion, due to the way some themes and plugins handle clicking those buttons.

    Thread Starter pjehan

    (@pjehan)

    Ok thanks for the reply.

    Then would it be a good idea to replace the anonymous function by a named function for the callback? So it would be possible to use the removeEventListener() function?

    Plugin Author Richard Webster

    (@rwebster85)

    It’s something I could look at mate sure.

    Thread Starter pjehan

    (@pjehan)

    Thanks!

    I think it might help others if they ever get in the same situation like I did.

    Thanks again for your plugin!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Difficulties to add event listener on download links’ is closed to new replies.