开发者

how to change zIndex .dragndrop question

开发者 https://www.devze.com 2022-12-19 02:08 出处:网络
first, have to look at this dragndrop (http://code.google.com/p/jquery-drag-and-drop/) what i want to ask is , isit possible to add a ACTIVE \"window\" onClick???

first, have to look at this dragndrop (http://code.google.com/p/jquery-drag-and-drop/)

what i want to ask is , isit possible to add a ACTIVE "window" onClick???

example:

i got 3 window dragable, name drag1 , drag2 and drag3

drag1 zIndex="98"

drag2 zIndex="99"

drag3 zIndex="100"

when i click on the drag1, change the drag1 zIndex value to highest than all the other drag.

after that, 开发者_如何学Go

i click drag3, also change the drag3 zIndex value to highest than all the other drag.

also high than the drag1

example2:

set a ACTIVE drag onClick???


Okay, I think I see what you are going for. You should use the jqueryui method draggable. It has an option stack that automatically gives the dragged item the highest z-index.

example

<script type="text/javascript">
$(function() {
    $('.boxes').draggable({stack:{group: ".boxes", min:100}});
});
</script>
<style type="text/css">
#wrapper {
    height: 500px;
    width: 700px;
    background-color: #fffac0;
    border: 2px dashed #fffa0d;
}
    .boxes {
         width: 100px;
         height: 100px;
         border: 1px solid #bbb;
     }
     #box1 {
         background-color: red;
     }
     #box2 {
         background-color: green;
     }
     #box3 {
         background-color: blue;
     }
</style>

<div id="wrapper">
    <div id="box1" class="boxes"></div>
    <div id="box2" class="boxes"></div>
    <div id="box3" class="boxes"></div>
</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号