Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Add CSS style attribute value to player wrapper

In order to get the player to align properly with surrounding content, I need to add a "clear: both" style attribute value to the _wrapper container. In looking at the configuration options, this does not seem to be an option, and I don't see a way to add arbitrary style attributes. I've tried adding it directly to the container after the call to .jwplayer():

$(wrapperSelector).css('clear', 'both');

where wrapperSeletcor is the ID of the div element (e.g. selector-id_wrapper), but that isn't working either. Is there an easy way to add this attribute value via jwplayer config, or do I have to add it separately?


3 Community Answers

Cooper Reid

JW Player Support Agent  
0 rated :

You may need to do this in the onReady event handler to make sure the player elements are in the DOM.
jwplayer().onReady(function() {
// your code


0 rated :

Yup, that was the trick, in addition to adding curly braces to my .css() code:

player.onReady(function() {
var wrapperSelector = '#' + selector + "_wrapper";
$(wrapperSelector).css({'clear': 'both'});

Cooper Reid

JW Player Support Agent  
0 rated :


This question has received the maximum number of answers.