Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
sunnyside

Button that pops-up a video lightbox

Question

14 answers to this question

Recommended Posts

  • 2

Out of so many possible ways to do it, this is how I've done it:

http://www.cregox.com/full-video/

There are quite many steps and options there. Here I'll write the most simplified version, with very basic steps which might not be so easy to follow but should be enough if you know how to find your way:

First,

.

Then, create a link anywhere you want with this updated to your video ID:


javascript:jqueryLightbox('RpLBR38kVvY');

Then, add the following script somewhere:


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

<script name="full video lightbox" author="cregox.com">
 // to use it, create a gallery block, make it a grid and check the Lightbox.
 // now add an item to it, either with the plus button or from another gallery.
 // finally add a link to any block you want,
 // calling jqueryLightbox function with a video url string.
 // for instance, to a vimeo video:
 // javascript:jqueryLightbox('video/127121696');
 //
 // for more info, visit www.cregox.com/full-video

 $(document).ready(function(){
   $('a[href^="javascript:jqueryLightbox("]').each(function(){
     var $videoButton = $(this);
     var videoString = $videoButton.attr('href').split("('")[1].split("')")[0];
     var $galleryLightbox = $('div[data-html*="'+ videoString +'"]');
     $galleryLightbox.parents('.sqs-block-gallery').hide(); // this is the line not being used in this page
     var $galleryLightboxImg = $galleryLightbox.find('img');
     $videoButton.click(function(){
       $galleryLightboxImg.hide(); // as to not show them before loading video
       $galleryLightboxImg.click();
     });
     $videoButton.attr('href', 'javascript:');
     $videoButton.addClass('lightboxed');
   });
 });

 function jqueryLightbox (videoString) {
   alert('jQuery not loaded');
 }
</script>


Edited by Caue

If you need support building your website, talk to me! <-- Check the link on the side.

Share this post


Link to post
  • 1

Sorry can someone help me out here please. I can't wrap my head around it.

I added long code to the Code Injection Section.I am having hard time to create a link for the button:

watch how

My video id is yui3172815017850435681117

Thank you in advance!

Share this post


Link to post
  • 0

Does anyone have any pointers on making the pop up fit the width of a mobile screen?At present it fills to the height and therefore won't let you play the video on mobile's (I'm using iOS for testing)

www.blockandlast.com

Any help would be appreciated.

Share this post


Link to post
  • 0

Does anyone have any pointers on making the pop up fit the width of a mobile screen?At present it fills to the height and therefore won't let you play the video on mobile's (I'm using iOS for testing)

www.blockandlast.com

Any help would be appreciated.

Share this post


Link to post
  • 0

This is great. Would you happen to know how I could apply such a technique to having a pop up lightbox video from clicking a button in the header space rather than the main body?

Share this post


Link to post
  • 0

This is great. Would you happen to know how I could apply such a technique to having a pop up lightbox video from clicking a button in the header space rather than the main body?

Share this post


Link to post
  • 0

@Caue, I'm looking to implement this in my website melvin-sng-axe3.squarespace.com.

I should have made a mistake somewhere because nothing happens when I click on the button I created for the javascript.

What I did was:

  1. I created a page under the Not Linked section to contain the gallery grid.
  2. I created a button on one of my index pages with the javascript.
  3. I put the above script via Code Injection section under Advanced settings.

Would you please advise?

Thanks in advance!

Mel

Share this post


Link to post
  • 0

Sorry, @fuzzykit I couldn't find the button or the script loaded there. Where are they supposed to be, exactly? Maybe they're in a page we can't see unless you link it to us.

I'm actually amazed my script is still working 1 year later...

It doesn't matter if the page is linked or not, at all. The gallery grid could have an effect, but probably not as well.

Try looking on the javascript console for error messages, they are usually very helpful.

That 5 minute challenge does sound interesting. :)


If you need support building your website, talk to me! <-- Check the link on the side.

Share this post


Link to post
  • 0

@Caue, Thanks for being interested in the challenge. It is indeed interesting.

I removed the button since I could not get it to work. I have put it back on the main banner. It's the "Watch Video" button. I have now created the gallery grid as part of the index. You should be able to see the same.

I tried looking at the console but there is not error message. I have tried adding the script at multiple locations - Advanced > Code Injection and "Advanced" tab of the index page. None works. :(

Hope you could help me. Thanks!

screen-shot-2016-07-23-at-104804-pm.png.c98c45f6705209bb04a6d8137f1c64b8.png

Share this post


Link to post
  • 0

Ok, I'm just guessing here, but maybe you should keep the thumbnail on the gallery.

Maybe the script could be modified to work even with "No Thumbnail" but right now I think it pretty much relies on it. Hopefully that's all.


If you need support building your website, talk to me! <-- Check the link on the side.

Share this post


Link to post
  • 0

Hi @Caue, I got it working. But what I found is the gallery block must be within the index page. Having it in an unlinked page will not work. Not sure if I missed something.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...