Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic-width backgrounds in li using IE8
    primarykey
    data
    text
    <p>I have been working on a new drop-down control, using dropkick, and I have it working in Chrome/FF, but not in IE8, which is sadly still our target. I used a single-pixel background image with <code>background-repeat:repeat-y</code> and <code>background-size:x%</code> to get the desired effect.</p> <p>I discovered too late that IE8 does not support background-size and my question is this: <strong>How do I emulate this effect in IE8?</strong></p> <p>My first thought is with some weird z-indexing and variable-width divs inside the <code>li</code> tags and behind the <code>a</code> tags, but my attempts at that have had less than spectacular results (largely because I have a hard time understanding css positioning). I am not sure how much it complicates things that this control resides on a draggable and resizable jQuery dialog, but for the sake of this question we can assume it won't move or change.</p> <p>The end result is something like this:</p> <p><img src="https://i.imgur.com/FxMaOvY.png" alt="control image"></p> <p>The numbers in the parens as well as the fill percentage are filled in with the options via an AJAX call.</p> <p>The code generated for the faux-dropdown is along these lines (truncated list):</p> <pre><code>&lt;div class="dk_options" style="top: 19px;"&gt; &lt;ul class="dk_options_inner"&gt; &lt;li class=" "&gt; &lt;a style="background-size:0%;" data-dk-dropdown-value=""&gt;&amp;nbsp;&lt;/a&gt; &lt;/li&gt; &lt;li class="dk_option_current "&gt; &lt;a style="background-size:6.6666666666666666666666666700%;" data-dk-dropdown-value="08:30AM"&gt;8:30 AM (1)&lt;/a&gt; &lt;/li&gt; &lt;li class=" "&gt; &lt;a style="background-size:13.333333333333333333333333330%;" data-dk-dropdown-value="08:45AM"&gt;8:45 AM (2)&lt;/a&gt; &lt;/li&gt; &lt;li class=" "&gt; &lt;a style="background-size:100%;" data-dk-dropdown-value="09:00AM"&gt;9:00 AM (15)&lt;/a&gt; &lt;/li&gt; &lt;li class=" "&gt; &lt;a style="background-size:0%;" data-dk-dropdown-value="09:15AM"&gt;9:15 AM (1)&lt;/a&gt; &lt;/li&gt; &lt;li class=" "&gt; &lt;a style="background-size:6.6666666666666666666666666700%;" data-dk-dropdown-value="09:30AM"&gt;9:30 AM (1)&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And the relevant css is something like this:</p> <pre><code>.dk_options_inner li { background:white; } .dk_options a { background-image:url(./images/dot.png); background-repeat:repeat-y; } </code></pre>
    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