I have a page (somepage.aspx) that has a popup video on it. The video opens when a link is clicked using the js $('.showVideo').live('click', function() {
I have another page (otherpage.aspx) and would like to link to /somepage.aspx
with some kind of URL parameter that automatically opens the video popup. Something like /somepage.aspx?video=1 ...
based on the url parameter the video would open. How would I add this to my existing js?
Thanks
Using this function you are able to detect the presence of
?video=1
in the url:Source: Get escaped URL parameter Credit to https://stackoverflow.com/users/726427/pauloppenheim
Then you could do something like:
edit:
Wrap the parameter name(video) in quotes
getURLParameter('video')
.Another Edit
Wrap your click event handler in a function, basically remove everything form:
Cut&paste it inside a function. Then just call the function from inside:
Then change the previous code to: