You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
giannif edited this page Dec 16, 2014
·
6 revisions
jQuery/Zepto support
This is a style preference, but the most popular reason to use it has been
to avoid having a global "player" variable and instead triggering off the $(".pjs")
jQuery collection. Since $ is usually accessible by most parts of the page,
it's a shortcut to just finding a way to sharing a reference to a normal PJS.Player
instance. Overall, not recommended.
Main benefit:
Use jQuery style event handlers and method invocations.
Events
Events work similar to hooking into a PJS.Player instance. Except you bind like so:
// you bind off the jQuery-wrapped placeholder element.$(".pjs").bind("pjs:ready",callback);
Also, your callback will be different. It will be a jQuery callback: the first argument will be the jQuery event, and the second will be the PJS.Playerevents object.
Methods
Methods can be triggered by calling trigger on a jQuery collection.
// you trigger off the jQuery-wrapped placeholder element.$(".pjs").trigger("pjs:pause");$(".pjs").trigger("pjs:playIndex",[1,10]);// Pass arguments as an array.