nk-o / jarallax

Parallax scrolling for modern browsers
https://jarallax.nkdev.info
MIT License
1.38k stars 210 forks source link

Add attribute to jarallax iframe? #182

Closed DaveAda closed 2 years ago

DaveAda commented 3 years ago

I am trying to add a 'title' to my jarallax iframe video to meet ADA guidelines. I've tried adding via jquery, the traditional way, but it is not working. Was hoping you could provide some potential insight on how to do this.

nk-o commented 2 years ago

Hey.

In the next Jarallax update will be available new method called onVideoInsert, which will help you recognize when the iframe is inserted on the page.

Usage example:

jarallax(document.querySelectorAll(".jarallax"), {
  onVideoInsert: function () {
    if (this.$video && this.$video.nodeName === "IFRAME") {
      this.$video.setAttribute("title", "HELLO");
    }
  },
});