2014-10-17 35 views
0

我使用插件调用http://www.skitter-slider.net/使用jQuery如何重写没有在jQuery中的元素的CSS规则?

和我遇到一个问题:

我想重写默认IMG CSS样式:

.box_skitter .box_clone img { 
    position: absolute; 
    top: 0; 
    left: 0; 
    z-index: 20; 

} 

,但我不能被改写元素class,id等。

$('.box_skitter .box_clone img').css({'width':w+'px','height':h+'px'}); 

因为插件会动态地创建img元素,意味着它没有任何作用,我设置heig ht,元素宽度img

那么有什么解决方案?

+2

您需要创建img元素的后应用的jQuery。不在准备就绪 – 2014-10-17 07:52:56

+0

焦点话题:jQuery假定像素,你不需要指定。 – George 2014-10-17 07:53:58

+0

它有一个'主题'选项。你可以使用你自己的主题。 – artm 2014-10-17 07:57:20

回答

0

我想我找到一个方法来解决:

$('head').append('<style>.box_skitter .box_clone img{width:'+w+'px !important;}</style>');