简体   繁体   English

在页面加载时打开侧面板

[英]open side panel on page onload

I want to open a side panel on page onload我想在页面加载时打开侧面板

code fragment used is使用的代码片段是

$(document).ready(function(event,ui)
{
   $("#mypanel").panel("open",{display: 'overlay', position: 'left'});
});

I am not an expert on jquery mobile but in this example( Fiddle ) the Panel is open on document load我不是 jquery mobile 的专家,但在这个例子中(小提琴)面板在文档加载时打开

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.2/jquery.mobile.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.2/jquery.mobile.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $("#mypanel").panel("open");
})
</script>
</head>

<body>
<div data-role="page">          
    <div data-role="panel" id="mypanel" data-theme="a" class="ui-response">
        <p>This is my content</p>
    </div>
   <div data-role="content">
     <a href="#mypanel" data-role="button" data-display="overlay" data-position="left" data-dismissible="true">Panel open/close</a>
   </div>
</div>
</body>
</html>

If this solution does not suit your needs, i apologize for making you lose time.如果此解决方案不适合您的需求,我很抱歉让您浪费时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM