javascript - Open a YouTube Video in FancyBox based on URL Parameter -


Actually not sure how to do this

  1. In an ideal world, I would like to be able to create several YouTube videos on one page and then users would like to come to my site via a provided link.
  2. This link will load a different YT video on the given page load.
  3. Sample Link provided to the user: 'mysite.com/videopage.html?PlayAd=ABC' or 'mysite.com/videopage Html = PlayAd = XYZ'
  4. If they If there are additional URLs on the site without the parameters, then no video will play and instead they will select themselves.

[code]

  & lt ;! - Add jQuery Library - & gt; & Lt; Script type = "text / javascript" src = "../ lib / jquery-1.10.1.min.js" & gt; & Lt; / Script & gt; & Lt ;! - Add MusicWheel plugin (this is optional) - & gt; & Lt; Script type = "text / javascript" src = "../ lib / jquery.mousewheel-3.0.6.pack.js" & gt; & Lt; / Script & gt; & Lt ;! - Add fancybox main JS and CSS files - & gt; & Lt; Script type = "text / javascript" src = "../ source / jquery.fancybox.js? V = 2.1.5" & gt; & Lt; / Script & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "../source/jquery.fancybox.css? V = 2.1.5" media = "screen" /> & Lt ;! - Add button assistant (this is optional) - & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "../source/over / jquery.fancybox-buttons.css? V = 1.0.5" /> & Lt; Script type = "text / javascript" src = "../ source / helpers / jquery.fancybox-buttons.js? V = 1.0.5" & gt; & Lt; / Script & gt; & Lt ;! - Add thumbnail assistant (this is optional) - & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "../source/over / jquery.fancybox-thumbs.css? V = 1.0.7" /> & Lt; Script type = "text / javascript" src = "../source/helpers/jquery.fancybox-thumbs.js? V = 1.0.7" & gt; & Lt; / Script & gt; & Lt ;! - Add Media Assistant (this is optional) - & gt; & Lt; Script type = "text / javascript" src = "../source/over / jquery.fancybox-media.js? V = 1.0.6" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('.fancybox'). Fancybox (); $ ('. Fancybox-media') .attr ('rel', 'media-gallery'). Fancybox ({openEffect : 'None', closeEffect: 'none', prevffect: 'none', next effect: 'none', arrow: wrong, helper: {media: {}, button: {}}});}); Function autoClick1 () {document.getElementById ('onload1'). Click (); } Function autoClick2 () {document.getElementById ('onload2'). Click (); } & Lt; / Script & gt; & Lt; / Style & gt; & Lt; / Head & gt; & Lt; Body Onload = "Autoclik 1 (); AutoCLICK 2 ();" & Gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; One class = "fancybox-media" href = "http://www.youtube.com/watch?v=opj24KnzrWo" id = "onload1" & gt; YouTube & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; One class = "fancybox-media" href = "http://www.youtube.com/watch?v=hnBN1Epc5qs" id = "onload2" & gt; Youtube2 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

My example is using Onload which allows to run the last video. It also plays the video without the URL parameter, so it plays on every page load. I have no idea how to do this. Any help is appreciated!

My demo site:


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -