简体   繁体   中英

EventListener to determine when data-src changes to src

So I've been messing with a piece of code for some time now, and I can't seem to properly determine when data-src changes to src - So I want to see if I can hook a EventListener to an element and see if we can properly determine it then.

So let's say that I have the following element let iframe = videoWrapper.html(videoElement).children('iframe'); which gives me:
在此处输入图片说明

Which renders like this:
在此处输入图片说明

Please note : A third-party implementation changes the data-src to src dynamically based on various actions.

Question :
What is the best approach to take to check when the data-src has switched over to src and then execute conditionals/methods? I'd like to hook a event listener to determine that, but I don't know which one would be the right approach.

All help is appreciated!

MutationObserver The MutationObserver interface provides the ability to watch for changes being made to the DOM tree. It is designed as a replacement for the older Mutation Events feature, which was part of the DOM3 Events specification. Read more...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM