javascript - Onscroll video has to play once -


using scrolltop divide scroll 5 section using if condition.in 2nd section gave video scrolltop value 600 700px.the video playing many times within position if scroll again.but want video has play once if number of times within value.

var scrolld=window.scrolltop(); if(scrolld >=600) {   ///i gave image here }  elseif((scrolld >600) & (scrolld <=700)){ //video }  //rest 3 elseif contain images 

check link: http://projects.lollypop.biz/auluxa/lighting.html

if scrolled using mouse working fine.but if scrolled using keyup , keydown(keyboard) video playing many times.

please take @ code. think mean, since have on website aswel, question not clear. can atleast share ur code?

$('#vid').on('ended', function(){this.playedthrough = true;});  $(window).scroll(function(){     var myvideo = document.getelementbyid("vid");      if($(window).scrolltop() > 300 && $(window).scrolltop() < 975){        // if didn't reached end yet        if(!myvideo.playedthrough)           myvideo.play();     }else{        myvideo.pause();     }  }) 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -