阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      插件 jQuery.lazyYT 中文API文档

      插件 jQuery.lazyYT 中文API文档 https://github.com/tylerpearson/lazyYT

      lazyYT.js

      Description

      This is a jQuery plugin to lazy load Youtube videos. On the initial load, the div will be appended by a preview img of the video. On click of the image, the preview img will be replaced by the autoplaying iframe Youtube video.

      Intro

      To read more information on the plugin and access a demo, view the intro post on newmediacampaigns.com.

      Demo

      1. Demo of v1.0.1
      2. View the demo. (older version)

      Setup

      <div class="lazyYT" data-youtube-id="_oEA18Y8gM0" data-ratio="16:9">loading...</div>
      
      1. Include the lazyYT JS and CSS files.
      2. Add a div where you want the video to be located. Add the id of the Youtube video to the data attribute youtube-id.
      3. Either add the video width and height to data-width and data-height, or add an ascpent ratio like 16:9 to data-ratio, none are required.
      4. Any optional parameters you wanted passed to the iframe url should be added to data-parameters.
      5. Get it started with $('.lazyYT').lazyYT();

      License

      (CC) Creative Commons

      目录
      目录