Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with Opacity in IE
    primarykey
    data
    text
    <p>I have a simple href that calls a javascript function that makes a div hidden and shows another one instead of it. Then I'm using javascript to put in some nice fade-in effect. It works fine in Firefox and chrome. On IE I had to use width: 100% to make it work. And tho it's working now, it totally ruins my font type. Here's the code:</p> <p><strong>Javascript:</strong></p> <pre><code>function switch() { if(document.getElementById("div1").style.visibility == "visible") { document.getElementById("div1").style.visibility = "hidden"; document.getElementById("div1").style.display = "none"; document.getElementById("div2").style.visibility = "visible"; document.getElementById("div2").style.display = "block"; initfade('div2'); } else { document.getElementById("div2").style.visibility = "hidden"; document.getElementById("div2").style.display = "none"; document.getElementById("div1").style.visibility = "visible"; document.getElementById("div1").style.display = "block"; initfade('div1'); } } function initfade(img) { imageId = img; image = document.getElementById(imageId); setOpacity(image, 0); image.style.visibility = 'visible'; fadeIn(imageId,0); } function setOpacity(obj, opacity) { opacity = (opacity == 100)?99.999:opacity; // IE/Win obj.style.filter = "alpha(opacity="+opacity+")"; // Safari&lt;1.2, Konqueror obj.style.KHTMLOpacity = opacity/100; // Older Mozilla and Firefox obj.style.MozOpacity = opacity/100; // Safari 1.2, newer Firefox and Mozilla, CSS3 obj.style.opacity = opacity/100; } function fadeIn(objId,opacity) { if (document.getElementById) { obj = document.getElementById(objId); if (opacity &lt;= 100) { setOpacity(obj, opacity); opacity += 30; window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100); } if (opacity &gt; 100) { setOpacity(obj, 100); } } } </code></pre> <p><strong>HTML:</strong></p> <pre><code>&lt;div id="div1" class="theStyle2_visible" style="visibility: visible;"&gt; &lt;div id="normal" class="normal"&gt; &lt;p&gt;Example Text&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="div2" class="theStyle2" &gt; &lt;div id="normal" class="normal"&gt; &lt;p&gt;Example Text&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;a id="switchlink" href="javascript:switch();"&gt;Switch&lt;/a&gt; </code></pre> <p><strong>CSS:</strong></p> <pre><code> .theStyle2 { visibility: hidden; width: 100%; display: none; z-index: -1; } .theStyle2_visible { width: 100%; } #normal{ font: 0.9em arial; font-weight:400; line-height: 20px; text-align:justify; } </code></pre> <p>I have no idea what I'm doing wrong and how to fix it or if this is just a bug but I've tried like a million things and nothing seems to work. Any good soul wanna help me? please!</p> <p>thanks.</p> <p>EDIT: Live link here: www.optimizer.pt/fade If you test it on firefox and IE you'll see what I mean. I have no idea what's going on...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload