[英]how to rewrite the css rule without the element in jquery?
I use a plugin call http://www.skitter-slider.net/ with jquery 我使用带有jQuery的插件调用http://www.skitter-slider.net/
and I meet a problem: 我遇到一个问题:
I want to rewrite the default img css style: 我想重写默认的img CSS样式:
.box_skitter .box_clone img {
position: absolute;
top: 0;
left: 0;
z-index: 20;
}
but I can't rewrite by the element class, id, etc.. 但我无法按元素类,id等进行重写。
$('.box_skitter .box_clone img').css({'width':w+'px','height':h+'px'});
because the plugin will create the img element dynamically, means It's no effect that I set the height, width for the element img 因为该插件将动态创建img元素,这意味着我为元素img设置高度和宽度没有影响
so what's the solution? 那么解决方案是什么?
我想我找到一种解决方法:
$('head').append('<style>.box_skitter .box_clone img{width:'+w+'px !important;}</style>');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.