Please help me to make video play automatically when at the moment of scrolling on #video-section
will be appeared .visible
class name․ And vice versa, when .visible
class name will be removed from section, the video will be stoped.
Thanks.
<section class="cd-section">
some content
</section>
<section id="video-section" class="cd-section">
<video>
<source src="http://www.w3schools.com/tags/movie.mp4" type="video/mp4">
</video>
</section>
<section class="cd-section">
some content
</section>
JSFiddle is here https://jsfiddle.net/y896ec5x/
What you're doing (based on the comments):
Is invalid, as jQuery doesn't have these functions natively.
Try using the
$.get
method, which returns a regular JavaScript DOM object of the element:Then to detect this at scrolling(parallax site without scrollbar), wrap it in a wheel event to handle that: