2014-09-27 101 views
0

我有我的网页的作品,我希望它的工作方式上的面板,只需要知道之前,我继续使用的面板是有可能 1.Have多板开在同一时间? (我想打开两个或更多的面板,每次打开一个新的面板时,其他的一切都被禁用,唯一有效的面板是一个打开的)创建jQuery的多个面板

如果没有,任何人都可以推荐一个很好的解决方案上述问题。

  • 我怎样才能去激活页面当面板打开

    <!DOCTYPE html> 
    <html> 
    <head> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.css"> 
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> 
    <script src="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.js"></script> 
    </head> 
    <body> 
    <div data-role="page" id="pageone"> 
    <div data-role="panel" id="myPanelDefault"> 
    <h2>Panel Header</h2> 
    <p>You can close the panel b:</p> 
    <a href="#pageone" data-rel="close" class="ui-btn ui-btn-inline ui-shadow ui-corner-all ui-btn-a  ui-icon-delete ui-btn-icon-left">Close panel</a> 
    </div> 
    <div data-role="panel" id="myPanelFixed" data-position-fixed="true"> 
    <h2>Panel Header</h2> 
    <p>You can close the panel by clicking outside the panel, pressing the Esc key, by swiping, or by clicking the button below:</p> 
    

    关闭面板

    页眉

    打开面板

    页脚

  • +0

    “我有我的页面上的面板上的” 帮助我们来帮您:请分享您的相关代码。 – Mooseman 2014-09-27 17:26:51

    +0

    我认为用JQM面板做这件事不会那么容易,但我记得在一面打开一个接一个地打开多个面板时看到了一个演示,但我不记得链接。你也可以使用幻灯片框自己制作 - 示例 - http://stackoverflow.com/questions/26061191/jquery-mobile-panel-slide-from-top-instead-from-right-and-left/26068437 #26068437 - 教程 - http://tympanus.net/codrops/2009/12/03/css-and-jquery-tutorial-overlay-with-slide-out-box/ – Tasos 2014-09-27 19:22:15

    回答

    2

    从我留在上面的评论中,我创建了一个演示,让您在同一时间打开2个面板。我不明白为什么你不能添加尽可能多的,因为你提供你设置屏幕上的每个面板位置,所以他们不会重叠。至于再次禁用它们应该不难。

    演示放大演示的窗口位

    http://jsfiddle.net/0mfgquv6/

    jQuery的

    $('#box').animate({'left':'-100%'},0) 
    $('#box2').animate({'left':'-100%'},0) 
    
    $(function() { 
    
        $('#openpanel').click(function(){ 
    
         $('#box').animate({'left':'0'},500); 
         $('#box2').animate({'left':'60%'},500); 
    
         }); 
    
        $('#close').click(function(){ 
    
         $('#box').animate({'left':'-100%'},500) 
    
        }); 
    
        $('#close2').click(function(){ 
    
         $('#box2').animate({'left':'-100%'},500) 
        }); 
    
    }); 
    
    +0

    噢,我的天啊,非常感谢你为此,你的生活节省。 :) – Annie 2014-09-27 19:59:03

    +0

    没问题,它确定:) – Tasos 2014-09-27 20:02:13

    +0

    我跟着你的例子到最后的细节,我没有编辑任何东西,但由于某种原因,当我尝试关闭面板单独的几个问题。我的小组定位正确,我不确定这是否有所作为。这里是我的代码[链接](http://jsfiddle.net/Annie_Bunny/ur4cs7js/) – Annie 2014-10-01 15:40:12