467,210 Members | 1,298 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,210 developers. It's quick & easy.

Conflict Script Problem

100+
Hi,

I need to use these 2 scripts together but for some reason when i try the first one does not work.

Script 1 is a IE PnG Fix and Script 2 is a image slideshow.

Expand|Select|Wrap|Line Numbers
  1. var arVersion = navigator.appVersion.split("MSIE")
  2. var version = parseFloat(arVersion[1])
  3.  
  4. if ((version >= 5.5) && (document.body.filters)) 
  5. {
  6.    for(var i=0; i<document.images.length; i++)
  7.    {
  8.       var img = document.images[i]
  9.       var imgName = img.src.toUpperCase()
  10.       if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
  11.       {
  12.          var imgID = (img.id) ? "id='" + img.id + "' " : ""
  13.          var imgClass = (img.className) ? "class='" + img.className + "' " : ""
  14.          var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
  15.          var imgStyle = "display:inline-block;" + img.style.cssText 
  16.          if (img.align == "left") imgStyle = "float:left;" + imgStyle
  17.          if (img.align == "right") imgStyle = "float:right;" + imgStyle
  18.          if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
  19.          var strNewHTML = "<span " + imgID + imgClass + imgTitle
  20.          + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
  21.          + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
  22.          + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
  23.          img.outerHTML = strNewHTML
  24.          i = i-1
  25.       }
  26.    }
  27. }
......
Feb 25 '08 #1
  • viewed: 1258
Share:
2 Replies
hsriat
Expert 1GB
Please post your question in parts as its too to be displayed here.
Feb 25 '08 #2
100+
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. var fadeimages=new Array()
  4. //SET IMAGE PATHS. Extend or contract array as needed
  5. fadeimages[0]=["images/entertainment-group.jpg", "", ""] //plain image syntax
  6. fadeimages[1]=["images/rock-concert.jpg", "", ""] //image with link syntax
  7. fadeimages[2]=["images/ballet.jpg", "", ""] //image with link and target syntax
  8. fadeimages[3]=["images/corporate-event.jpg", "", ""] //image with link and target syntax
  9. fadeimages[4]=["images/wedding-chair.jpg", "", ""] //image with link and target syntax
  10. fadeimages[5]=["images/dj-decks.jpg", "", ""] //image with link and target syntax
  11.  
  12. var fadeimages2=new Array() //2nd array set example. Remove or add more sets as needed.
  13. //SET IMAGE PATHS. Extend or contract array as needed
  14.  
  15. var fadebgcolor="white"
  16.  
  17. ////NO need to edit beyond here/////////////
  18.  
  19. var fadearray=new Array() //array to cache fadeshow instances
  20. var fadeclear=new Array() //array to cache corresponding clearinterval pointers
  21.  
  22. var dom=(document.getElementById) //modern dom browsers
  23. var iebrowser=document.all
  24.  
  25. function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
  26. this.pausecheck=pause
  27. this.mouseovercheck=0
  28. this.delay=delay
  29. this.degree=10 //initial opacity degree (10%)
  30. this.curimageindex=0
  31. this.nextimageindex=1
  32. fadearray[fadearray.length]=this
  33. this.slideshowid=fadearray.length-1
  34. this.canvasbase="canvas"+this.slideshowid
  35. this.curcanvas=this.canvasbase+"_0"
  36. if (typeof displayorder!="undefined")
  37. theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
  38. this.theimages=theimages
  39. this.imageborder=parseInt(borderwidth)
  40. this.postimages=new Array() //preload images
  41. for (p=0;p<theimages.length;p++){
  42. this.postimages[p]=new Image()
  43. this.postimages[p].src=theimages[p][0]
  44. }
  45.  
  46. var fadewidth=fadewidth+this.imageborder*2
  47. var fadeheight=fadeheight+this.imageborder*2
  48.  
  49. if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
  50. document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
  51. else
  52. document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
  53.  
  54. if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
  55. this.startit()
  56. else{
  57. this.curimageindex++
  58. setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
  59. }
  60. }
  61.  
  62. function fadepic(obj){
  63. if (obj.degree<100){
  64. obj.degree+=10
  65. if (obj.tempobj.filters&&obj.tempobj.filters[0]){
  66. if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
  67. obj.tempobj.filters[0].opacity=obj.degree
  68. else //else if IE5.5-
  69. obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
  70. }
  71. else if (obj.tempobj.style.MozOpacity)
  72. obj.tempobj.style.MozOpacity=obj.degree/101
  73. else if (obj.tempobj.style.KhtmlOpacity)
  74. obj.tempobj.style.KhtmlOpacity=obj.degree/100
  75. }
  76. else{
  77. clearInterval(fadeclear[obj.slideshowid])
  78. obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
  79. obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
  80. obj.populateslide(obj.tempobj, obj.nextimageindex)
  81. obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
  82. setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
  83. }
  84. }
  85.  
  86. fadeshow.prototype.populateslide=function(picobj, picindex){
  87. var slideHTML=""
  88. if (this.theimages[picindex][1]!="") //if associated link exists for image
  89. slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
  90. slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
  91. if (this.theimages[picindex][1]!="") //if associated link exists for image
  92. slideHTML+='</a>'
  93. picobj.innerHTML=slideHTML
  94. }
  95.  
  96.  
  97. fadeshow.prototype.rotateimage=function(){
  98. if (this.pausecheck==1) //if pause onMouseover enabled, cache object
  99. var cacheobj=this
  100. if (this.mouseovercheck==1)
  101. setTimeout(function(){cacheobj.rotateimage()}, 100)
  102. else if (iebrowser&&dom||dom){
  103. this.resetit()
  104. var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
  105. crossobj.style.zIndex++
  106. fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
  107. this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
  108. }
  109. else{
  110. var ns4imgobj=document.images['defaultslide'+this.slideshowid]
  111. ns4imgobj.src=this.postimages[this.curimageindex].src
  112. }
  113. this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
  114. }
  115.  
  116. fadeshow.prototype.resetit=function(){
  117. this.degree=10
  118. var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
  119. if (crossobj.filters&&crossobj.filters[0]){
  120. if (typeof crossobj.filters[0].opacity=="number") //if IE6+
  121. crossobj.filters(0).opacity=this.degree
  122. else //else if IE5.5-
  123. crossobj.style.filter="alpha(opacity="+this.degree+")"
  124. }
  125. else if (crossobj.style.MozOpacity)
  126. crossobj.style.MozOpacity=this.degree/101
  127. else if (crossobj.style.KhtmlOpacity)
  128. crossobj.style.KhtmlOpacity=obj.degree/100
  129. }
  130.  
  131.  
  132. fadeshow.prototype.startit=function(){
  133. var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
  134. this.populateslide(crossobj, this.curimageindex)
  135. if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
  136. var cacheobj=this
  137. var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
  138. crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
  139. crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
  140. }
  141. this.rotateimage()
  142. }
  143.  
Cheers,
Adam
Feb 25 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by sentinel | last post: by
3 posts views Thread by email@davefink.com | last post: by
2 posts views Thread by loquini | last post: by
reply views Thread by Caesar Augustus | last post: by
2 posts views Thread by kae | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.