Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery animate width without reflow of content?
    primarykey
    data
    text
    <p>I've searched here and googled for hours, but have yet to find a solution to this problem... Basically, I have a giant list of icons that once each list item is hovered, it expands to reveal the textual name of the item. However, upon animating the width, the entire document is forced to reflow.</p> <p>Is there any way around this? I've tried every combination of jQuery and css I can think of to no avail. I've attempted adding absolute positioning (relative to the parent UL) once hovered with positions based on jQuery position()... However, that doesn't work as I had hoped.</p> <p>I'd really like to be able to hover each icon, have it expand to show the text, but rather than reflowing the rest of the content, simply act as if it is in a fixed position and therefor not interacting with the rest of the content layout.</p> <p>Here's the animation bit:</p> <pre><code> $('.service-generator li').hover(function() { var labelWidth = $(this).children('label').width() + 41; $(this).animate({width: labelWidth + 'px'}, 180); }, function() { $(this).animate({width: '35px'}, 180); }); </code></pre> <p>Also, I suppose a view of the actual markup might be helpful, so here you go:</p> <pre><code>&lt;ul class="service-generator"&gt; &lt;li id="[service-name]" class="full-service-wrapper photo"&gt; &lt;label class="icon-name" for="[service-name]-checkbox"&gt;[service-name]&lt;/label&gt; &lt;div class="icon-wrapper"&gt; &lt;input type="checkbox" checked="checked" name="[service-name]" id="[service-name]-checkbox"&gt;&lt;img alt="[service-name]" title="[service-name]" src="[service-name].ico"&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And here's an image displaying the result: <img src="https://i.stack.imgur.com/PJ5oB.png" alt="enter image description here"></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.
    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