How to leave an entire page linked to a button?

0

How can I leave an entire page linked to a button? Example: link when the person clicks on any area of the site click on the play button or the youtube video that will be on the page, as if it was an invisible advertisement on the whole page, leaving clickable

    
asked by anonymous 22.06.2017 / 06:33

2 answers

1

sfiddle

Just associate the click event with document instead of the id of the #btnPlay button

Library

<script type="text/javascript" src="//code.jquery.com/jquery-2.1.0.js"></script>

<script type="text/javascript" src="https://www.youtube.com/iframe_api"></script>

Script:YoushouldsetthevideotovideoId:'YeiYa70RxRc'

$(window).load(function(){varplayer=newYT.Player('player',{width:540,height:320,videoId:'YeiYa70RxRc'});$(document).on("click", function() {
    player.playVideo();
});
});

Html

<div id="player"></div>
    
22.06.2017 / 13:51
0

From the click event in the window or document, with javascript, so when any place of the screen or document is clicked this event will be executed

$(window).click(function() {
    console.log("Botão clicado")
});

or

$(document).click(function() {
console.log("Botão clicado")
});
    
22.06.2017 / 21:55