user3053590
user3053590

Reputation: 25

JS script doesn't work when I zoom in web browser

Can anyone explain why this js script does not work when I zoom in my web browser?

function resizePlayer(){
 if(jwplayer().getWidth() == 596) { 
 jwplayer().resize(1004,565); 

 } else {
 jwplayer().resize(596,335);

 }
 };

Upvotes: 0

Views: 145

Answers (1)

qiu-deqing
qiu-deqing

Reputation: 1333

function resizePlayer(){
 if(jwplayer().getWidth() == 596) { 
 jwplayer().resize(1004,565); 

 } else {
 jwplayer().resize(596,335);

 }
 };


you need attach the listener to an element such as window :

window.onresize = resizePlayer;

http://www.w3schools.com/jsref/event_onresize.asp

Upvotes: 1

Related Questions