Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

jQuery .click sends customized URL

8 replies [Last post]

Hi all,

I'm trying to configure my script to allow the user to click a thumbnail, which will pop up the corresponding video in a lightbox. In order to grab the unique id of the link, i assigned an attribute (title) to the link and wanted to use jQuery to set it to a var and pass it into the url for jw.

<script type="text/javascript">
$(document).ready(function() {

$(".inline").click(function(){
var videoTitle = $(this).attr("title");
      return false;
});
});
</script>

so somehow i need to send my variable videoTitle and insert it in the jw flashvar "file" so it looks something like this

so.addVariable('file','http://www.coldopenmedia.com/vid/emp/' + file + '.flv');

i'm pretty new at this, so any help is appreciated. thanks!

thanks for the response. JW box is cool, but it overlooks the idea of the script im trying to write.... i'd like for the url in the JW flashvars to be written dynamically based on an attribute of the link that is clicked.... this way, i only have one set of flashvars on the page that are changed via clicking a link... it also cuts back significantly on the amount of code... i just dont know how to get it functioning

 
Multiple players — one set of code (flashvars, params, attributes).?

See this thread:

    http://www.longtailvideo.com/support/forum/Bug-Reports/20110/Server-Not-Found-Error-in-

JW Box uses a different technique. It instantiates the players in a hidden HTML element. then when a player is requested, the element is made visible.

Hey Hobbs,

Thanks for the response. That other thread has the right idea, and I may use it, but I have two questions.

1) Since my player needs to instantiate inside of a fancybox (lightbox alternative), I must set the href of the thumbnail to the #div that contains my inline information. Is there a way to set the href AND send the javascript to the player?

2) I had thought to make things easier, I could set an attribute to the link/thumbnail that is clicked, which jQuery would read and set as a variable. This variable could then be inserted into the jwPlayer file flashvar like so:

so.addVariable('file','http://www.coldopenmedia.com/vid/emp/' + file + '.flv');

This way, I wouldn't have to set a link for every thumbail, only set the attribute to the filename/video title (this helps for the client too, since they arent super html savvy.

Thanks for any insight, jw rocks!

 
Yeah, both items should be doable.

I haven't specifically tried it, but even with the onclick handler in an anchor element, whatever is in the href does get acted upon, that's why we put "#" or void there.

any idea on how i'd be able to get the onclick / jquery .click to send the link's title attribute to jwplayer?

If you're sending "things" to an already instantiated player as a LOAD Event, you can send any of the File Properties flashvars.

If you're sending "things" to a JavaScript function that is going to instantiate the player, you can send any of the Adobe Flash Player parameters or any of the JW Player flashvars.

can you show me the URL? I'm trying to do the same thing