<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Garrick Cheung &#187; markup hierarchy</title>
	<atom:link href="http://www.garrickcheung.com/tag/markup-hierarchy/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.garrickcheung.com</link>
	<description>Sharing what I know and learn about CSS, MooTools, Javascript, PHP and etc.</description>
	<lastBuildDate>Wed, 28 Apr 2010 02:52:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Solution to Flash and Select Drop-downs Covering HTML Elements</title>
		<link>http://www.garrickcheung.com/javascript/solution-to-flash-and-select-drop-downs-covering-html-elements/</link>
		<comments>http://www.garrickcheung.com/javascript/solution-to-flash-and-select-drop-downs-covering-html-elements/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 13:00:15 +0000</pubDate>
		<dc:creator>Garrick</dc:creator>
				<category><![CDATA[HTML / XHTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[markup hierarchy]]></category>

		<guid isPermaLink="false">http://www.garrickcheung.com/?p=91</guid>
		<description><![CDATA[I&#8217;ve positioned elements absolutely and had to deal with a bug where the element appears below a flash object or select drop-downs, which usually occurs in IE. I&#8217;ve seen a few solutions, which work great, and I have one more to add. Solution 1: iFrame This solution comes from Joe King&#8217;s post. In case you [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve positioned elements absolutely and had to deal with a bug where the element appears below a flash object or select drop-downs, which usually occurs in IE. I&#8217;ve seen a few solutions, which work great, and I have one more to add.<span id="more-91"></span></p>
<h3>Solution 1: iFrame</h3>
<p>This solution comes from <a href="http://www.dotnetjunkies.com/WebLog/jking/archive/2003/07/21/488.aspx" target="_blank">Joe King&#8217;s post</a>.</p>
<blockquote><p>In case you don&#8217;t already know, windowed controls in IE will always cover DHTML layers.  That means if you have a DIV that pops up or floats on the page and it intersects with a windowed control (such as the common SELECT box), the windowed control will obscure the DIV, no matter what zIndex you have set for each element.</p></blockquote>
<p>The solution is to create an iFrame shim under the element that needs to appear above the select drop down.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> element <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'id_of_element'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> iframe_shim <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Element<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'iframe'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">'id'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'shim'</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">'scrolling'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'no'</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">'frameborder'</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">'styles'</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #3366CC;">'width'</span><span style="color: #339933;">:</span> element.<span style="color: #660066;">getSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">//Plug in the width of absolutely positioned object here</span>
        <span style="color: #3366CC;">'height'</span><span style="color: #339933;">:</span> element.<span style="color: #660066;">getSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">y</span><span style="color: #339933;">;,</span> <span style="color: #006600; font-style: italic;">//Plug in the height of absolutely positioned object here</span>
        <span style="color: #3366CC;">'filter'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'</span> <span style="color: #006600; font-style: italic;">// fixes transparency</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">inject</span><span style="color: #009900;">&#40;</span>element<span style="color: #339933;">,</span><span style="color: #3366CC;">'after'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//this automatically injects the shim after the element.</span></pre></td></tr></table></div>

<p>Keep in mind you&#8217;ll probably need to modify this to work with your needs. E.g. For drop down navigation, you would create the shim and use Javascript to make adjustments to the position and dimensions of the shim to reflect that dropped down menu in the navigation.</p>
<h3>Solution 2: Flash Param: wmode=transparent</h3>
<p>This solution was found on <a href="http://www.cssplay.co.uk/menus/flyout_flash.html" target="_blank">CSS Play by Stu and Fran Nicholls</a>.</p>
<p>So you have a flash object and you require HTML elements to appear above it. You set the HTML elements positioning to absolute and try z-index, which probably didn&#8217;t work in IE. You only need to set the flash object&#8217;s wmode parameter to transparent to fix this. Use the &lt;param&gt; to set the name/value, and set the wmode attribute on the &lt;embed&gt; tag like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;
&lt;embed src=&quot;flash.swf&quot; quality=&quot;high&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;100&quot; height=&quot;100&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;</pre></td></tr></table></div>

<h3>Solution 3: Markup Hierarchy</h3>
<p>Let&#8217;s say you have a flash object that you have no control over, such as a YouTube video. The flash object comes in with wmode=&#8221;window&#8221; or something. What do you do? Consider markup hierarchy. In IE, the next HTML element is considered at a higher layer than the element before it.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;box_1&quot;&gt;Box 1&lt;/div&gt;
&lt;div class=&quot;box_2&quot;&gt;Box 2&lt;/div&gt;</pre></td></tr></table></div>

<p>Box 1 will appear above Box 2. So using the drop down navigation as an example again (from solution 1) I would use Javascript to relocate the navigation&#8217;s html markup below the flash object and adjust the positioning of the nav to make it look like it never moved via CSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.garrickcheung.com/javascript/solution-to-flash-and-select-drop-downs-covering-html-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
