Saturday 15 February 2014

javascript - How to hide image on click with two functions? -



javascript - How to hide image on click with two functions? -

i'm using simple image i'm trying on click of image 2 things first hide image , play content in i'm using iframe video has no play button 1 time click on anywhere of video plays i'm trying add together simple play button utilize click on image , video play need help javascript help appreciated.

<div id="playbutton"> <img style="width: 200px; height: 200px; border: 0;" src="http://iconshots.com/wp-content/uploads/2010/01/final1.jpg"> </div>

check fiddle out @ http://jsfiddle.net/cwl9moqk/4/

try this:

jquery: $(document).ready(function() { $('#play-video').on('click', function(ev) { $("#video")[0].src += "&autoplay=1"; ev.preventdefault(); }); }); html: <div id="playbutton"> <img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:and9gcrh0aw8dopc_x6jfb8wyuivroo9xy0ewwqskikb8mme_aaepfuzeowimq" onclick="this.style.display='none';" id="play-video"> <iframe id="video" width="420" height="315" src="//www.youtube.com/embed/9b7te184zpq?rel=0" frameborder="0" allowfullscreen></iframe> css: #play-video { width: 200px; height: 200px; border: 0; bottom: 10; left: 0; right: 0; position: fixed; text-align: center; margin: 0px auto; }

check fiddle out @ http://jsfiddle.net/cwl9moqk/4/ if need more help or not looking please comment - i'm happy help!

javascript jquery html

No comments:

Post a Comment