Awesome q2a theme

Where to put return false; or event.preventDefault()?

0 like 0 dislike
31 views
There are videogaleria and it is such a problem that if you start one video and then go to the 2nd, 3rd, 4th and primary testing by clicking on play, the video opens in a new tab - this can not happen. It is interesting that if you go back to the website and click, it's normally in the website starts. And this problem is only in Mozilla, in chrome not.
Googled that you can cancel the navigation by using return false; or event.preventDefault() - I assume will turn out that users will need to double-click on a play(well, it's bearable) . But I don't know where to insert(to be honest I have not studied JS and CSS, it's only a glimpse of HTML.... but apparently good at googling and somehow successfully sculpt your difficult site with other people's codes)) Please help who know)
I'll give a good example code in the editor - https://jsfiddle.net/sergeybreen/u6o6e5x7/1/
Yes, there is another thing that after the opening of the "Show Video" will open a fake frame which should be a picture of the play button(third from the player videohost). But in the editor you will see only an empty space, click on it, it is a primary testing of the present iniitial iframe videohost. The trick is not to unnecessarily load the website when video is many tens to hundreds of times faster loading site. It turns out mnogova something times have to click to start the video, well, it's also bearable. Although if anyone knows how to make after clicking on "Show Video" immediately prokralsya a real iframe and not the fake preview-button the play be grateful for this decision.

Perhaps another videohost would be better without this glitch, but replacements have not yet considered.
by | 31 views

2 Answers

0 like 0 dislike
e.preventDefault() is blocking native action/event.
And the return false stops further code execution within the function.

Now let's see what's in the example

UPD: if the video is in an iframe, you don't succeed, you can't affect the DOM inside
by
0 like 0 dislike
1. It is better to use data-id
2. What's stopping you clicking on the name to clear the contents of all spoilers, and in the current upload iframe from YouTube with AutoPlay setting?
3. A click should be 1, don't make people do unnecessary work
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
asked Apr 9, 2019 by springimport
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users