kevinweber / lazy-load-for-videos

Speed up your site by replacing embedded Youtube and Vimeo videos with a clickable preview image. Free WordPress plugin.
http://wordpress.org/plugins/lazy-load-for-videos/
GNU General Public License v3.0
41 stars 23 forks source link

Updated video.js file for variable video ratio #26

Closed lucasdidthis closed 5 years ago

lucasdidthis commented 5 years ago

Variable size (ratio) for all video embeds. Testet with a striped down (CSS only) Twenty Nineteen Theme and Wordpress WordPress 5.2.1. A solution for Issue #22.

kevinweber commented 5 years ago

Correct. If you actually change the relevant file instead of adding a new file with copied code, the changes will be obvious.

On Sun, Jun 2, 2019, 3:15 PM Lucas notifications@github.com wrote:

@lucasdidthis commented on this pull request.

In video.js https://github.com/kevinweber/lazy-load-for-videos/pull/26#discussion_r289642146 :

+import { onBindFirstLoad } from '../utils/jQueryBindFirst'; +import jQueryAjaxStop from '../utils/jQueryAjaxStop'; +import findElements from '../utils/findElements'; +import debounce from '../utils/debounce'; + +const videoratio = 0.5625; + +export function setBackgroundImage(element, imageUrl) {

  • // Don't simply set "background:url(...)..." because this prop would override
  • // custom styling such as "background-size: cover".
  • element.setAttribute('style', background-image:url(${imageUrl});background-color:#000;background-position:center center;background-repeat:no-repeat;); +}
  • +const debouncedResize = debounce(() => {

  • findElements('.container-lazyload').forEach((domContainerItem) => {
  • / change ratio /

I inserted the comment for you to easier identify my changes, which isn't really necessary in a git, I suppose.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kevinweber/lazy-load-for-videos/pull/26?email_source=notifications&email_token=AAVID7YZ6R65WV67NBNZS4DPYPBYNA5CNFSM4HSCOXXKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB2KLFCA#discussion_r289642146, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVID7ZNIQ5YL7J5GMADEY3PYPBYNANCNFSM4HSCOXXA .