[英]create border around div and his children using wrapAll
My code not workin well. 我的代码无法正常运行。 I want to create border around div id="wrap_all" and his children using warpAll().
我想使用warpAll()在div id =“ wrap_all”及其子项周围创建边框。 Did Is it possible to use with
$("#wrap_all").wrapAll("<div></div>");
是否可以和
$("#wrap_all").wrapAll("<div></div>");
If yes I don't know how to that. 如果是的话,我不知道该怎么做。 I am allso don't know how to include
id="xxx"
inside ("<div id="xxx"></div>")
order for manipulate the new div with id xxx to make 我还不知道如何在
id="xxx"
("<div id="xxx"></div>")
顺序("<div id="xxx"></div>")
$(#'xxx')..css("border", "3px double red");
link for examle: http://jsfiddle.net/centerwow/9TPtn/27/ Thanks. 例如的链接: http : //jsfiddle.net/centerwow/9TPtn/27/谢谢。
code html: 代码html:
<div class="foo">a</div>
<div class="foo">b</div>
<div class="foo">c</div>
<div id="foo" class="foo">d</div>
<div id ="wrap_all">
<div class="foo">r</div>
<div class="foo">f</div>
<div class="foo">g</div>
</div>
<div class="foo">h</div>
<span></span>
link for examle. 链接示例。
jquery code: jQuery代码:
var modWidth = 50;
$('#wrap_all').hover(function() {
$(this).warpAll()
$(this).css("background", "green");
$(this).css("border", "3px double red");
$(this).width(modWidth);
}, function() {
$(this).css("background", "#cac");
$(this).width(40);
});
Not sure if this is the problem, but the code you posted says 不知道这是否是问题,但是您发布的代码说
$(this).warpAll()
Instead of 代替
$(this).wrapAll();
(Notice the corrected spelling of "wrap" and the added semicolon). (请注意,“ wrap”的正确拼写和添加的分号)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.