Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This not a problem with the html or your selector, but instead the way the css map function works. In this case, you are not sending the browser a stylesheet that it can parse and decide which background statement to use. Instead, jQuery is overwriting the background-image property each time, so the final background-image property for any browser is the last, <code>'linear-gradient(to bottom, #2c3c6f, #071f31)'</code>. You can test, as I did, this by removing the gradient lines that are incompatible with your browser and re-running the fiddle.</p> <p>The way to fix this would be to add conditional lines of JavaScript that assign the appropriate background-image property according to which browser is being used.</p> <p>So...</p> <p>IF Safari 4+, Chrome 1-9 ...</p> <pre><code>$("#list .active").closest('.header').css({ 'background-color' : '#1a2e51', 'background-image' : '-webkit-gradient(linear, left top, left bottom, from(#2c3c6f), to(#071f31))' });​ </code></pre> <p>ELSE IF Safari 5.1+, Mobile Safari, Chrome 10+ ...</p> <pre><code>$("#list .active").closest('.header').css({ 'background-color' : '#1a2e51', 'background-image' : '-webkit-linear-gradient(top, #2c3c6f, #071f31)' });​ </code></pre> <p>ELSE IF Firefox 3.6+ ...</p> <pre><code>$("#list .active").closest('.header').css({ 'background-color' : '#1a2e51', 'background-image' : '-moz-linear-gradient(top, #2c3c6f, #071f31)' });​ </code></pre> <p>ELSE IF Opera 11.10+ ...</p> <pre><code>$("#list .active").closest('.header').css({ 'background-color' : '#1a2e51', 'background-image' : '-o-linear-gradient(top, #2c3c6f, #071f31)' });​ </code></pre> <p>And so on.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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