jquery – 可拖动div的z-index顺序

前端之家收集整理的这篇文章主要介绍了jquery – 可拖动div的z-index顺序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在我的网站上创建一个可拖动的媒体播放器(在我的例子中为蓝盒子),我需要将媒体播放器放在所有div之前.我怎样才能做到这一点?

我的页面模板是这样的:

你可以尝试一下:http://jsfiddle.net/krMhY/

<html>
  <head>
    <Meta http-equiv="content-type" content="text/html; charset=utf-8" />  
    <title>Popup Test</title>


    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/jquery.ui.full.js" type="text/javascript"></script>

    <style type="text/css">
        .contents
        {position:fixed; bottom:0; left: 0; right:0; top:100px;}

        .resizableArea
        {position:absolute; bottom:0; top:0; width:100%;}

        .resizableArea .leftSection
        {position:relative; float:left; width: 150px; height:100%;}

        .resizableArea .splitter
        {position: absolute; left: 150px; width: 4px; height: 100%;}

        .resizableArea .rightSection
        {position: relative; overflow: auto; height: 100%;}    
    </style>
  </head>
  <body                               style="z-index: 1; background-color: purple;">
    <div class="contents"             style="z-index: 2; background-color: black;">
        <div class="resizableArea"    style="z-index: 3; background-color: aqua;">
            <div class="leftSection"  style="z-index: 4; background-color: yellow;">&nbsp;</div>
            <div class="splitter"     style="z-index: 7; background-color: green;">&nbsp;</div>
            <div class="rightSection" style="z-index: 6; background-color: red;">&nbsp;<br />
                <div id="drag"        style="z-index: 8; background-color: blue; width: 100px; height: 100px;">&nbsp;</div>
            </div>
        </div>
    </div>

    <script language="javascript" type="text/javascript">
        $("#drag").draggable();
    </script>
  </body>
</html>

谢谢大家……

解决方法

改为以下将解决
.resizableArea .rightSection
{ overflow: auto; height: 100%;} 

#drag
{position: absolute;}
原文链接:https://www.f2er.com/jquery/180982.html

猜你在找的jQuery相关文章