I have a main HTML file and many iframe elements stored in external HTML files are only users After clicking on the Navigator button, it is loaded on demand.
$ ('# carousel_01'). Load ('content_01.html'); Each iframe * src * attribute indicates Vimeo video I attach an event listener function for each Vimeo video Which monitors the video's position and triggers a certain action within the main HTML document (mostly animation).
The problem is: After loading the external iframe, it is not being registered as a part of the document in the main HTML file if I have all the iframes within the main HTML document
var vimeoPlayers = document.querySelectorAll ('iframe'), ask the player using; Only the first loaded iframes are returned, the ones that were loaded dynamically are not in the list (while still showing and appearing on the main page) . I can not engage event listeners in the video without being able to query loaded iframes. How can I apply updates to the main HTML document so that it can recognize the imported loaded iframe?
Since AJAX is asynchronous, you need to update the variable in the callback function:
$ ('# carousel_01'). Load ('content_01.html', function () {vimeoPlayers = document. QuerySelectorAll ('iframe');});
No comments:
Post a Comment