Welcome to WebmasterWorld Guest from 54.146.59.202

Forum Moderators: incrediBILL

Message Too Old, No Replies

Anchors and Autoplay Video

anchor to another page and autoplay

     
9:49 pm on Jun 17, 2014 (gmt 0)



To those of you who are really good at writing code this is probably a simple question. I have created a Button on my homepage that directs you to another page and to a particular spot on that page. I did this by making the HREF for the Button an anchor. Currently the anchor takes you to a spot just above a video (the Button is intended to direct you to said video).

Is it possible to have the anchor also start playing the video when the Button is clicked?
Currently I have set the video's embedded code to auto play, but I do not want the video to auto play if you access the page by any other means. I only want it to auto play if you click the Button, but otherwise I'd like a user to have to manually start the video. So can I code the Button to include an action like "play"? Again, my Button currently does not point to the video, it points to an anchor just above the video.

if you'd like to see the website, it is <snip> and the Button I'm talking about is "Go To Video"


*I capitalized the word "Button" throughout to make clear that I am consistently referring to the same button.

[edited by: incrediBILL at 12:17 am (utc) on Jun 18, 2014]
[edit reason] URls removed. No Site Reviews. Please see forum charter and TOS. [/edit]

9:51 pm on Jun 17, 2014 (gmt 0)



If it helps, the code I currently have for the button is below:

<a href="/project-discovery/#IntroVideo"/class="arrow_btn">Go to Video</a><br>
1:22 am on Jun 18, 2014 (gmt 0)

WebmasterWorld Administrator 5+ Year Member Top Contributors Of The Month



<a href="/project-discovery/#IntroVideo"/class="arrow_btn">Go to Video</a><br>
This link isn't quite right, is this:
..ideo"/class="ar..
a typo or an exact copy of what you are using?
4:10 pm on Jun 18, 2014 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld!
As not2easy pointed out, it looks like you have an extra slash in that line.

In any case, on the page where your embed video is located, you'll want some JavaScript that runs when the window.onload event fires. That script should check to see if window.location.hash === "#IntroVideo", and if so, autostart the video. This will not prevent someone from navigating directly to the the "/project-discover/#IntroVideo" page without pushing the button, but it will only autostart the video if the #IntroVideo is in the url, which I suspect is what you're trying to achieve.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month