School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

IE compatibility issue .... it works everywhere else ...

#1 roudard  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05


Dream Kudos: 0

Share |

IE compatibility issue ....

Posted 14 July 2009 - 07:38 AM

Hey guys ...

Have an issue with the website I'm building.
I'm using the prototype library along with scriptaculous..
nothing really fancy or out of the ordinary...

There are a few videos to be looked at - it's a website for a wedding films production company (well the wedding films production company a friend and I are creating) -
I built the following js class - quite straight forward to dim the page, open the player - a flash player you may already be familiar with ... here is the code with a few comments :

var BPPlayer = Class.create({
	initialize: function(videoElement) {
			this.videoWidth = videoElement.width;
			this.videoHeight = videoElement.height;
		this.videoFile = videoElement.pathToMovie;
		this.id = "BPPlayer";
			// first, we destroy the player if it already exists ... shouldn't happen, but it doesn't hurt .. just in case
		this.destroy();
			// then we go to the heart of the problem
		this.DOMcreate();
	  },
	DOMcreate: function() {
			 var fullScreen = new Element("div");
			 fullScreen.id = this.id;
			 fullScreen.setAttribute("class","curtain");
			 fullScreen.setAttribute("style","position:absolute;top:0px;left:0px");

			 //fullScreen.style.display='none';
			 fullScreen.style.width = $('body').offsetWidth+"px";
		 fullScreen.style.height = $('body').offsetHeight+"px";
		 //Effect.toggle(fullScreen,'appear');
		 // the part above here makes a great big div the background pic is a grey image at about 20% opacity for the dim effect - I commented out the Effect to avoid problems ...

			 // the following part just builds the table that will contain the closing button, the background, the borders, the logo and the container for the player

		var player = new Element("div");
		player.id = "playerContainer";
		var x = ( $('body').getWidth() - this.videoWidth ) / 2;  /// yeah .. i gave the id "body" to the body
		player.style.position='absolute';
		player.style.left=x+"px";
				player.style.top= $('body').scrollTop+120+"px";
		player.style.display='';

		var table = new Element('table');
		table.cellSpacing = 0;
		table.cellPadding = 0;
		table.border = 0;
		table.setAttribute("class",'playerTable');
		
		var row = new Element('tr');
		row.height='30px';
		var cell = new Element('td');
		cell.height = '30px';
		cell.width = '30px';
		cell.appendChild(this.closeButton());
		cell.id = 'top-left';
		row.appendChild(cell);
		var cell = new Element('td');
		cell.id = 'top';
		row.appendChild(cell);
		var cell = new Element('td');
		cell.width = '30px';
		cell.id = 'top-right';
		row.appendChild(cell);
		table.appendChild(row);
		
		var row = new Element('tr');
		var cell = new Element('td');
		cell.width = '30px';
		cell.id = 'left';
		row.appendChild(cell);
		var cell = new Element('td');
		cell.id = 'player1';
		row.appendChild(cell);
		var cell = new Element('td');
		cell.id = 'right';
		cell.width = '30px';
		row.appendChild(cell);
		table.appendChild(row);

		var row = new Element('tr');
		var cell = new Element('td');
		cell.width = '30px';
		cell.id = 'left';
		row.appendChild(cell);
		var cell = new Element('td');
		cell.align='center'
		cell.id = 'player-logo';
		cell.innerHTML = '<img src="./interface/images/player/logo.png"/>';
		row.appendChild(cell);
		var cell = new Element('td');
		cell.id = 'right';
		cell.width = '30px';
		row.appendChild(cell);
		table.appendChild(row);

		var row = new Element('tr');
		row.height='30px';
		var cell = new Element('td');
		cell.height = '30px';
		cell.width = '30px';
		cell.id = 'bottom-left';
		row.appendChild(cell);
		var cell = new Element('td');
		cell.id = 'bottom';
		row.appendChild(cell);
		var cell = new Element('td');
		cell.width = '30px';
		cell.id = 'bottom-right';
		row.appendChild(cell);
		table.appendChild(row);

		
		player.appendChild(table);
		fullScreen.appendChild(player);
		$('body').appendChild(fullScreen);

				// the next 2 commands call the UFO class to create the flash player in the container td defined above
		var FO = {	movie:"./interface/flv_player/flvplayer.swf",width:(this.videoWidth-35),height:this.videoHeight,majorversion:"7",build:"0",bgcolor:"#FFFFFF",
						flashvars:"file="+this.videoFile+"&lightcolor=0xFFFFFF&showdigits=true&autostart=true&showfsbutton=false" };
		UFO.create(	FO, "player1");
		
	  },
	closeButton: function() {
		var button = new Element('a');
		var img = new Element('img');
		button.href='java script:void(0)';
		button.setAttribute('onclick','BPPlayerInstance.close()');
		img.border=0
		img.style.position='relative';
		img.style.top='5px';
		img.style.left='5px';
		img.src='./interface/images/closebox.png';
		button.appendChild(img);
		return button;
	},
	destroy: function() {
		if($(this.id)) {
			$(this.id).remove();
		}
	},
	close: function() {
		this.destroy();
	}
	
});



the css for curtain (i added the same as in-line style def but it hasn't changed a thing):
.curtain {
	background-image:url('../images/curtain.png');
	position:absolute;
	top:0px;
	left:0px;
}



right ... so that works brilliantly in safari 3,4 and FF 2,3 ... but not in IE :crazy:

in IE when the handler is called and an instance of BPPlayer in initialised, the browser viewport just doubles in size and there is nothing in the second half...

when i alert the content of the fullScreen element it looks pretty good, everything seems to be where it should be and I managed to get rid of all errors that IE was throwing at me ... but still no luck ...

I'm probably using some properties that IE doesn't like .... but I need another set of (skilled) eyes to have a look at it ...
Thanks in advance !!! :D

oh it is -kinda- live here : http://www.bluepencilfilms.com

Romain
Was This Post Helpful? 0
  • +
  • -


#2 SoLi  Icon User is offline

  • andydust.com
  • PipPipPipPipPip

Reputation: 38
  • View blog
  • Posts: 1,432
  • Joined: 27-January 02


Dream Kudos: 0

Re: IE compatibility issue ....

Posted 14 July 2009 - 10:43 AM

in IE you cannot set class names with setAttribute ( as you are doing for your curtain class and playerTable ).
use element.className = "whatever", which works in all browsers.

Let me know how it goes.

This post has been edited by SoLi: 14 July 2009 - 11:01 AM

Was This Post Helpful? 1
  • +
  • -

#3 roudard  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05


Dream Kudos: 0

Re: IE compatibility issue ....

Posted 14 July 2009 - 03:26 PM

exactly the kind of stuff i was looking for ... thanks a million !
the curtain shows now .. but not the playerContainer div ...
it's getting late will keep on looking tomorrow.. thanks again !

View PostSoLi, on 14 Jul, 2009 - 10:43 AM, said:

in IE you cannot set class names with setAttribute ( as you are doing for your curtain class and playerTable ).
use element.className = "whatever", which works in all browsers.

Let me know how it goes.

Was This Post Helpful? 0
  • +
  • -

#4 roudard  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05


Dream Kudos: 0

Re: IE compatibility issue ....

Posted 08 September 2009 - 01:45 AM

Alright it's fixed !!

apparently IE didn't like the fact that the player div was containing a big dynamically rendered table.
So I scratched it and did the layout of the player with div's

It now works like a charm...

I know it's been a while but still wanted to post the answer as it might help someone facing the same kind of issue :)
Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users