Dynamic resizing via Javascript in WordPress

I have a pretty straightforward page in WordPress, which works fine outside the WordPress framework, but once I integrate it into a WordPress theme it refuses to re-size a element. The rest of the function executes OK, but the resizing is ignored.

Is there something special about getting Javascript working in a WordPress theme?

function play_vid(vid,xSrc,xWidth,xHeight,xTitle){
  var myVideo = document.getElementById(vid); 
    myVideo.src=xSrc;
    myVideo.style.width=xWidth;
    myVideo.style.height=xHeight;

  var myVideoPlate = document.getElementById('video_plate'); 
  myVideoPlate.style.width=xWidth+40;
  myVideoPlate.style.height=xHeight+60;

  var myVideoTitle = document.getElementById('video_title'); 
  myVideoTitle.innerHTML=xTitle;
  myVideoTitle.style.height=xHeight+60;


    var myElement = document.getElementById("video_plane"); 
    myElement.style.minHeight="100%";
    myElement.style.visibility="visible";
  document.body.style.overflow="hidden";
  myVideo.play(); 
}

Related posts

1 comment

  1. The style attributes have to be valid css strings, that means you can’t just use the numbers you also have to add the measurements, which you are missing @height and @width.
    Just add +”px”

    myVideoTitle.style.height=(xHeight+60)+"px";
    

Comments are closed.