1
seppel
Javascript on entire Site
  • 2005/9/12 7:09

  • seppel

  • Just popping in

  • Posts: 7

  • Since: 2004/1/19


Hi,

i want to use a Javascript that solves the Transparency-Problem of IE with png Images on my Xoops-Site.

Where do i have to put this script ?

2
romu
Re: Javascript on entire Site
  • 2005/9/12 9:18

  • romu

  • Theme Designer

  • Posts: 22

  • Since: 2002/12/5


Hi, Why no include it in a .js file called from your theme.

ie :
in body tag,
<script language="JavaScript" type="text/javascript" src="<{$xoops_imageurl}>/YOURSCRIPTNAME.js">script>

3
JMorris
Re: Javascript on entire Site
  • 2005/9/12 10:25

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Quote:

seppel wrote:
Hi,

i want to use a Javascript that solves the Transparency-Problem of IE with png Images on my Xoops-Site.

Where do i have to put this script ?


Would you mind sharing the script? That transparency issue in IE drives me nuts!

Thanks!

James
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

4
seppel
Re: Javascript on entire Site
  • 2005/9/12 12:15

  • seppel

  • Just popping in

  • Posts: 7

  • Since: 2004/1/19


Here's the script:

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
for(var i=0; i {
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = " + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progidXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\">
"
img.outerHTML = strNewHTML
i = i-1
}
}
}
window.attachEvent("onload", correctPNG);

5
marook
Re: Javascript on entire Site
  • 2005/9/12 20:36

  • marook

  • Friend of XOOPS

  • Posts: 89

  • Since: 2002/9/9 1


Hi,

Nice, but how does it compare to this: http://koivi.com/ie-png-transparency/ ?

Any concerns with JS needs in the browser?
Also, where is the test for the browser type? This would seem to replase PNG tags in all browsers or does it use a JS implementation that is IE only??
Marook,

Want to go on a Safari with me?
(Yes, it is me in that avatar.. )

6
seppel
Re: Javascript on entire Site
  • 2005/9/14 5:44

  • seppel

  • Just popping in

  • Posts: 7

  • Since: 2004/1/19


I'm not the author of this script. I just found it when searching for a solution of this PNG-IE Problem, and thought it could be useful. I have tested it with IE 6.0 and Firefox an it works fine in both Browsers.

7
davidthomas1
Re: Javascript on entire Site

You don't need to modify your theme file.

The best place to but your custom javascript is in /include/xoops.js

That way the script is included in every page and you don't have to edit your theme everytime you want to change themes.

cheers,

D.
みんなちがってみんないい。

XOOPS 2.0.13.2

8
seppel
Re: Javascript on entire Site
  • 2005/9/14 5:54

  • seppel

  • Just popping in

  • Posts: 7

  • Since: 2004/1/19


, thanks

9
davidthomas1
Re: Javascript on entire Site

You're welcome.

Remember to back up your xoops.js file before editing it.

Also, it's a good idea to add your custom code at the end with comments to indicate it's custom code.

all the best,

D
みんなちがってみんないい。

XOOPS 2.0.13.2

10
romu
Re: Javascript on entire Site
  • 2005/9/14 7:00

  • romu

  • Theme Designer

  • Posts: 22

  • Since: 2002/12/5


xoops.js is a nice place.
But you'll need to remember you hacked it at each XOOPS upgrade !
That's why I told you about using your theme js file that is your own code and won't be changed by any classic upgrade.

Login

Who's Online

498 user(s) are online (425 user(s) are browsing Support Forums)


Members: 0


Guests: 498


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits