I'm trying to adapt a videoplayer to meet my needs (resizing).
At this moment almost everything is ok, but I have a problem when 2 or more players are showed in the same page (the jquery reference is always pointing to the last player).
To fix it, I'm trying to use jquery selector:
$('className').each(function() { /* call resize function */ } );
Now I have a problem because I can call resize function using MyObject1.resize();
but the selector only returns div
tags (id="obj1"
, id="obj2"
) and I don't now how can I get MyObject1
, MyObject2
and so on, so I could call resize function for every object.
So, how can I call a function defined like Object.prototype.resize = function() {...}
from the jquery selector each loop?
UPDATE ****************
Hi, thanks for all your replies, Im not an js expert, sorry :)
Im trying to adapt leanback HTML5 Video Player which js file start as :
"use strict"
;(function(window, undefined)
{
var document = window.document, navigator = window.navigator, location = window.location, ua$ = navigator.userAgent;
var LBP = function(o, v, h5o) { ... };
LBP.prototype.initializeKeys = function() { ... }
...
LBP.prototype.initializeAPlayer = function() {
LBP.prototype.initializeVPlayer = function() {
LBP.prototype.resize = function() { .. }
I have 3 players in html (classname = "vPlayer") so I want to call the resize function from the three player, not only from the last.
Jquery Selectors returns something like div tags so I don't know how to call functions from the LBP objects