0

I have this piece of CSS:

.image-wrap:after {
    content: ' ';
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
    box-shadow: inset 0px 0px 0px 5px red;
}

I would like to 'write' this in Jquery. I'm having trouble with :after Is there any way of using :after in Jquery? Please take a look at my full code: http://jsfiddle.net/WpGsx/23/

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Youss
  • 4,196
  • 12
  • 55
  • 109
  • What are you looking to accomplish? – j08691 Mar 27 '13 at 20:18
  • @j08691 I can't use css in stylesheet or inline(with HTML) with the script Im working on. So I would like to write the css in Jquery. In this case I would like to set :after in Jquery code. So basically do the same thing as you see in the Fiddle but without the css rules on the right. – Youss Mar 27 '13 at 20:21
  • The supposed duplicate is about the 'content' its not about using :after – Youss Mar 27 '13 at 20:29
  • Did you read the title of the duplicate? – BoltClock Mar 27 '13 at 20:33
  • this is not a duplicate, his main goal is to add a box shadow with inset to/around the image, question should be edited though – Huangism Mar 27 '13 at 20:37
  • @BoltClock He wants to change 'foo' in to 'bar' and the anwser is `$(this).attr('data-content','bar')` How does that help me?? – Youss Mar 27 '13 at 20:38
  • Or even relate to my question – Youss Mar 27 '13 at 20:38
  • you should edit the question to ask how to add an inset box shadow to an image using jquery – Huangism Mar 27 '13 at 20:48
  • 1
    @Youss: Scroll down; there's more than one answer to that question. Your question as it is is the same as the other question. That's why I marked them as dupes. – BoltClock Mar 28 '13 at 07:04
  • @BoltClock Thank you:) Got it http://jsfiddle.net/WpGsx/32/ – Youss Mar 28 '13 at 10:38

1 Answers1

0

Ok here is the inset

http://jsfiddle.net/WpGsx/30/

you might wanna check in different browsers

var $wrap = $('.image-wrap');

$wrap.css({
    'box-shadow': 'inset 0px 0px 0px 5px red',
    'position':'absolute',
    'left':'0',
    'top':'0',
    'padding':'5px 5px 0 5px'
});
Huangism
  • 16,278
  • 7
  • 48
  • 74