Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple videos on multiple sections. #14

Closed
niklasquitzau opened this issue Mar 24, 2014 · 7 comments
Closed

Multiple videos on multiple sections. #14

niklasquitzau opened this issue Mar 24, 2014 · 7 comments

Comments

@niklasquitzau
Copy link

Is it in any way possible to have more than one video playing as background on other sections on one page? And if yes, then how? :)

Thanks for a great plugin, btw!

@damonbauer
Copy link
Contributor

Haven't tested, but you should be able to just make a new call to the plugin, with whichever selector you want the video to play in. For instance:

var video1 = new $.backgroundVideo($('#section1'), { ... };
var video2 = new $.backgroundVideo($('#section2'), { ... };

@niklasquitzau
Copy link
Author

Thank you for your quick reply!

I have tried it now, but it doesn't seem to work.
It outputs the html fine (<video ... >) but I can see that the id in the video-tag is the same as my first video: id="video_background"- any ideas?

Thank you :)

@damonbauer
Copy link
Contributor

In your plugin call, give each video a unique id, like:

var video1 = new $.backgroundVideo($('#section1'), {
    videoid: "video1",
    ....
};
var video2 = new $.backgroundVideo($('#section2'), {
    videoid: "video2",
    ....
};

@niklasquitzau
Copy link
Author

That worked beautifully! Thank you sir!

Now, I have a little problem with position: fixed because all of my content scrolls right over the video, as it is not moving. I have then set the position to absolute which solved my problem with the first video, but now the second video is positioned in the top behind my first video and not as a background in the section further down on the page.. Hope this makes sense. Any help is greatly appreciated :)

Thanks again.

@damonbauer
Copy link
Contributor

Totally makes sense. This is a CSS issue rather than a plugin issue. I'd suggest reading about CSS positioning.

I think what you're looking for is to have 2 sections that have position: relative, then place each video inside of those with position: absolute.

position: absolute works off of it's parent. If there isn't a parent, it is absolute to the window. However, if you put it inside of a div with position: relative, the position: absolute div is placed in relation to the div, not the window.

http://css-tricks.com/absolute-relative-fixed-positioining-how-do-they-differ/
http://learnlayout.com/position.html
http://learn.shayhowe.com/html-css/box-model

@niklasquitzau
Copy link
Author

Thank you very much for you help, damonbauer.

I will look into it - i figured that's where the problem probably was. Thanks again!

@niklasquitzau
Copy link
Author

Aaaaaand, it's working.

Thanks, and closing 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants