How can I add a close button to a html video popup? - javascript

I have an image on my site, and when you click on the image, a video pops up and starts playing. I am wondering how I can add a close button on this video to go back to website rather than pressing back.
I'm pretty experienced with HTML CSS but very new to JS.
This is the code that causes the popup video.
<div class="image-wrapper">
<a href="assets/video.mp4">
<img src="assets/img.png">
</a>
</div>
Thanks for any help here.

I suggest that, you add all the code. HTML/CSS/JS and so, we can help you.
I recommend that, a snippet, that stackoverflow eases you.
enter image description here
The snippet is:
snippet
If you are new in JS. I recommend work with the framework jQuery.

Related

Photos gallery for full screen website

I have a website mainly for read comic book online.
So when upload content to web page, most of them are images. My content will be something like this.
<p>
<img src="img1">
<h1>Some text</h1>
<img src="img2">
<img src="img3">
</p>
I want when user click img1 it will show full screen. Click next button will show img2 and so on.
is there any photo library for this job.
Yes, Of course.
Very fewer people are familiar with this awesome javascript gallery library. I hope you know basic javascript.
Read their docs and you will master that just in few minutes. Here is their link below.
For better understanding try to understand their codes in Codepen.
Click here to go their official page
If you check out this Stack Overflow link, there are several examples of photo galleries that you can build upon.
You can click JSFiddle Photo Gallery to see the code and run the example.
You can also look at the other examples on the Stack Overflow link. This code is free to use and modify.

How to use jCarousel to enlarge a slider?

I have implemented jcarousel.
My website looks like this: what my website looks like now
What I want to do, is that when the user clicks on enlarge, I want the picture to open in a new tab and have it be a slider as well. Basically I want to open the slider in a new tab when the enlarge image is clicked.
Im new to this, I'm not sure what to do or where to start. All i have done is place the code below on the enlarge image. Please advise me on what to do?
<a href="javascript:enlarge()" class="enlarge">
<img src="/theme/images/magnify.gif" border="0" title="enlarge" alt="enlarge" style="margin:;">
</a>
Try use some "js modal gallery" it have enlarge effect and dont need open new tab
in short adding target to an anchor will open it in a new tab,
The long answer is I have no idea what you're needing to execute when the new page is loaded, that is something that is going to be beyond this initial question.

window.location.href navigates out of my website

Okay now i'm having a tough situation. I'm using a free html template. So far i have been able to do the following:
When a user clicks the thumbnail. The video will play where it should.
All i had to do with add the direct raw video file to the href of that image.
<a class="thumbnail" href="VIDEO_LINK.MP4"><img src="http://i.imgur.com/KWyIHw8.jpg" /></a>
Then i came accross a problem where the raw link would display on the bottom left of the browser.
I fixed it by adding an onclick event to form a function.
<a class="thumbnail" href="#" onclick="video();"><img src="http://i.imgur.com/KWyIHw8.jpg"/></a>
The function is:
Function video() {window.location.href = 'VIDEO_LINK_HERE.MP4'}
Well it turns out that now when i click the image it navigates the whole page to that link.
I need to know how i can make it play without navigating out of my website like in the first picture and most importantly not showing the raw video link.
Try using the jquery load func, to load the image in a specific div
$("#div1").load("http://i.imgur.com/KWyIHw8.jpg")

How to hyperlink text to an external website on Wordpress Fancybox images

I am trying to link these fancy box images to a website externally.
For example: http://www.dramaticsnyc.com/stylistsandlocations/
Click on one of the stylists and the image pops up. On the bottom it says click here to read and write reviews. When you click on it, it doesnt go to the page, it gets stuck on the same page. How can I make it link to the site on the hyper link? Any help would be appreciated. Thanks.
Here is the code I am currently using for each picture (put this code in fancygallery caption):
<div style="display: none;">
<div id="hover-image_0">
<a class="fancyframe" href="http://www.reviewmenyc.com">Click here to write and read reviews! Review Me NYC</a>
</div>
</div>
It only links to the site internally not externally. If you click on the link, its supposed to go to www.reviewmenyc.com but its staying under www.dramaticsnyc.com. What do I have to do the change this? I am not the greatest but I can learn and I know my way around.
<a class="’fancyframe’" href="’http://www.reviewmenyc.com’">Click here to write and read reviews! Review Me NYC</a>
Should be:
<a class="fancyframe" href="http://www.reviewmenyc.com">Click here to write and read reviews! Review Me NYC</a>
There is no need for the extra ' in the class and the href
Also, instead of changing the page location, you might want to just open a new tab. If so, use this:
<a target="_blank" class="fancyframe" href="http://www.reviewmenyc.com">Click here to write and read reviews! Review Me NYC</a>

Video on popup page still playing even when I close the popup layer

I have a popup layer on my website that show the latest news on it. Now I want to embed a YouTube video on it, that plays once the user open the website. And I would like it to stop playing after the user close the popup page. I have tried SoundCloud player and it stops when I close it.
Here is the live link.
You can also download the file source file on here (.zip):
Source Files
So I want to make the video stops playing when the user closes the popup page.
Any idea?
Thanks in advance.
Friend's
Don't try to close the facebox/fancybox pop up window. Try to create a container that holds the video file/embed code. After clicking on Close link, just remove the HTML of that embed/video file container.
Ex. <div id="myVideoFilePlay">Video File/Embed Data</div>
Script File:
document.getElementById('remodeVideoPlayer').innerHTML ="";
After that close the fancy box
Here is some information about the auto-play feature for embedding in YouTube.
http://support.google.com/youtube/bin/answer.py?hl=en&answer=1181821
"To make it autoplay, just put &autoplay=1 after the video ID so it looks like this:"
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/XXXXXXX&autoplay=1"></param>
<embed src="http://www.youtube.com/v/XXXXXXX&autoplay=1" type="application/x-shockwave-flash" width="425" height="350">
</embed></object>
As for stopping the video, I advise you have a look here and set up some simple functions to do the pausing upon clicking "X". See: How to pause a YouTube player when hiding the iframe?
EDIT: Added more info..
I can see you set your jQuery to #dialogjj upon the site loading, and then the HTML is inside of the div so setting it to display:none; it wont stop it playing. I have an idea to make it work - there may be a better one out there with nicer jQuery but this works fine. I feel that no one is going to reply further due to the way the question was asked/not very easy to look into unfortunately. That is perhaps why you got a downvote on this question, have a look how other people ask questions here for future guide, its generally not just giving links to your website expecting people to look, instead try to pin point your problem adn what you have tried so other people can have a clue about it, but we all start somewhere so dont worry :).
My idea is that you actually set the contents FOR #dialogjj with jQuery (so the embed code is put in via the JS file and not the HTML page) and in that same way you can actually append it to get rid of that embed code. I have set up a simple JSfiddle that does this in the same fashion as you want. Its up to you to merge it into your code though :)
JS FIddle link http://jsfiddle.net/ivandude/vLrvA/2/
If you like the solution please click tick as the answer :D my first one maybe.. haha
The answer was really easy. When I used the old object embed code, it just worked. Thanks for the suggested solution but it works for iframe. But does not need any additional code.

Categories