2

I am trying to figure this issue:

I have a :after class on my menu that shows an image and its working well after I work with this method:

:after and :before css pseudo elements hack for IE 7

I added the jquery that was mentioned there:

http://jquery.lukelutman.com/plugins/pseudo/

working good locally, but when I added this in my server it works well on homepage (IE7) url-homepage/images/image.jpg.

...But when I go to another page the pseudo does the path like this: url-homepage/about/images/image.jpg...how can i prevent this..I assume its the pattern on the js..

    var patterns = {
    text: /^['"]?(.+?)["']?$/,
    url: /url\(["']?(.+?)['"]?\)$/
};

function clean(content) {
    if(content && content.length) {
        var text = content.match(patterns.text)[1],
            url = text.match(patterns.url);
        return url ? '<img src="' + url[1] + '" />': text;
    }
}

Anyone know how to get it to be only go to one path (/path/images/)?

Community
  • 1
  • 1
Riskbreaker
  • 4,621
  • 1
  • 23
  • 31
  • 1
    Modernizr only detects WHETHER a browser supports certain features. It doesn't actually "modernize" old browsers. That's what polyfills do. – Blazemonger Feb 22 '13 at 16:16
  • 1
    I'm assuming all your images are stored in `root/images` so in the example you gave you need to back out. You could do `../images/` or `/images/` to start at root and then get image. I'm not that great with regexp. Did you make those? – Iron3eagle Feb 22 '13 at 16:18
  • dN yes its on root like this */images/* not sure how to get this on the js though – Riskbreaker Feb 22 '13 at 16:21
  • Just a thought of something to try, again I'm not great at decoding regexp or building them, but in you return did you try just doing `'` and `"/"+text` not sure if it'll help but I'd say worth a try. – Iron3eagle Feb 22 '13 at 16:23
  • Thanks defaultNINJA you had the right comment :) – Riskbreaker Feb 28 '13 at 17:11

1 Answers1

4

Would be interesting to see your CSS, but in lack of that I guess that your content should read:

url(/images/image.jpg)

starting with the slash so that the path starts at your server's root (instead of being relative to your current folder).

Edit: So, in summary I'd suggest the following style:

#yourElementId, #yourElementId:after {
    after: url(/images/image.jpg);      /* IE7 polyfill */
    content: url(/images/image.jpg);    /* css for other browsers */
}
marty
  • 4,005
  • 22
  • 19
  • ahh CSS wasnt even looking at that I have it as: `.top-nav li a:after {after: url("images/image.jpg"); content: url("images/image.jpg");}` – Riskbreaker Feb 28 '13 at 16:04