admin管理员组文章数量:1333480
How to create a button that will overlay each html element with class WSEDIT.
First I Know I'll need a javascript loop to find each element with css Class WSEDIT and create on the fly a button and prepend this button in each element with WSEDIT class.
Example of javascript loop and the button creation
$(function()
$(".WSEDIT").each(function(){
var btnConfigure = $("<div class='BBtnConfigure'>");
$(this).prepend(btnConfigure);
});
);
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
</p>
<div>
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<h2>Sale For First Trimestriel</h2>
<img src="/graph.png" />
<div>
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<table>
<tr><td>Name</td><td>Sex</td></td>Age</td<td>Country</td></tr>
...
</table>
<div>
Here is what I'm trying to do in the following picture.
The question is , What should be the CSS for my btn class button BBtnConfigure
As you can see in the picture, the BtnConfigure is overlapping each Section.
How to create a button that will overlay each html element with class WSEDIT.
First I Know I'll need a javascript loop to find each element with css Class WSEDIT and create on the fly a button and prepend this button in each element with WSEDIT class.
Example of javascript loop and the button creation
$(function()
$(".WSEDIT").each(function(){
var btnConfigure = $("<div class='BBtnConfigure'>");
$(this).prepend(btnConfigure);
});
);
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
</p>
<div>
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<h2>Sale For First Trimestriel</h2>
<img src="/graph.png" />
<div>
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<table>
<tr><td>Name</td><td>Sex</td></td>Age</td<td>Country</td></tr>
...
</table>
<div>
Here is what I'm trying to do in the following picture.
The question is , What should be the CSS for my btn class button BBtnConfigure
As you can see in the picture, the BtnConfigure is overlapping each Section.
1 Answer
Reset to default 5- The container (WSEDIT) should have
position:relative
so you can absolutely-position the button. - The button should be inside the container
- The button needs:
position:absolute; top:-10px; right:-20px
(approximately)
本文标签: javascriptHow create an overlay button on different containing divStack Overflow
版权声明:本文标题:javascript - How create an overlay button on different containing div - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742350275a2458350.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论