Victor
Victor

Reputation: 489

jQuery backup for old browser support

https://stackoverflow.com/a/12059220/1421561

I love Davids code, but like to know the best way to give it support in < IE7. My first idea was to use a statement "if there is a child add a class". The class would then link to a background image positioned in a similar way.

What would your solution be?

Here is Davids fiddle: http://jsfiddle.net/w9xnv/2/

Edit: support for this in < IE7:

.menu li > a:after { margin-left: 5px; content: '\25BA'; }

Upvotes: 1

Views: 103

Answers (2)

Victor
Victor

Reputation: 489

It seemed that no one read that I wanted a jQuery backup for this. I understood already that there was no support for this with CSS for IE7.

Anyhow this is my solution, if someone would be looking for the same thing.

JS (jQuery):

<!--[if IE 7]>
    <script type="text/javascript"> 
         $(function () {
             $("#mainnavi li:has(ul)").addClass("ie7_dropdown_arrow");
         });    
    </script>   
<![endif]-->

CSS:

#mainnavi .ie7_dropdown_arrow {
    *background: url(../images/dropdown_arrow.png) no-repeat right 0px;
    *padding-right: 20px;
}

#mainnavi .ie7_dropdown_arrow:hover {
    *background: url(../images/dropdown_arrow.png) no-repeat right -15px;   
}

Upvotes: 0

Spudley
Spudley

Reputation: 168803

Unfortunately, I don't know of any way to support the :before and :after selectors in IE7 or earlier. It simply isn't supported.

For a lot of CSS stuff, there are hacks that can force old IEs to work -- tools like Selectivizr or CSS3Pie.

However I know of no such hacks for :after. Sorry about that.

You can research it for yourself:

My sincere advice is to drop support for IE7 on your site. Unless you have a specific need to support it, the odds are no-one will even notice -- there are very few IE7 users out there these days; the usage for it dropped off much quicker than IE6, and today they're both sitting at under 1% of global browser usage. Judge for yourself whether it's worthwhile sweating over that half percent of users (who are probably well used to seeing sites that don't work properly anyway).

Upvotes: 1

Related Questions