pupunzi / jquery.mb.YTPlayer

use a custom yutube player for a video as background on jQuery framework
https://pupunzi.com/mb.components/mb.YTPlayer/demo/demo.html
1.32k stars 429 forks source link

mb.YTPlayer v. 3.4.0 doesn't center correctly #419

Closed Saintpid closed 5 years ago

Saintpid commented 5 years ago

I've selected center, center and that has previously centered the video nicely, since the latest update the film is pushed to the right side of the window.

Saintpid commented 5 years ago

www.saintpid.se

pupunzi commented 5 years ago

Hi, you've several javascript errors on your page that could compromise the correct behavior of the plugin.

Saintpid commented 5 years ago

Thanks. I'll look into that.

Saintpid commented 5 years ago

Hello again, I think I removed or fixed every javascript error I could find. I still get errors but those seem to be caused by Chrome Extensions since I get no errors in an incognito window. The background video still doesn't center correctly. Do you have any more ideas that could be the cause, the former version worked?

pupunzi commented 5 years ago

Hi, can you try changing

line 2588:

            default:
              if (vid.width > win.width)
                vid.marginLeft = -((vid.width - win.width) / 2) + (abundance / 2);
              break;

with:

            default:
              if (vid.width > win.width)
                vid.marginLeft = -(((vid.width + abundance) - win.width ) / 2) ;
              break;

on the jquery.mb.YTPlayer.js

Or just set the "abundance" parameter to 0

Saintpid commented 5 years ago

That snippet of code moved the movie too far to the left instead of too far to the right, it didn't center it. I tried to remove the '+ abundance' and that centered it correctly (but surely messed up something else of course), hope this is helpful. I left it like that for now, so the current code is:

default: if (vid.width > win.width) vid.marginLeft = -(((vid.width) - win.width ) / 2) ; break;

Saintpid commented 5 years ago

I just saw that you posted an update (3.4.1), it works as expected again. Thank you!

andreafrison commented 5 years ago

I just saw that you posted an update (3.4.1), it works as expected again. Thank you!

Where can i find 3.4.1?

With the latest release (3.2.9) I have a vertical alignment problem. Center/center doesn't work!

pupunzi commented 5 years ago

@andreafrison Saintpid refers to the Wordpress plugin. The fix has not been released yet. If you download the master it contains the fix for that otherwise I'll publish the 3.3.0 in the next days.