One.
Two, source code.
<!doctype html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>saving Portal state-jquery easyui</title>
<link rel= "stylesheet" type= "Text/css" href= "Http://www.jeasyui.com/easyui/themes/default/easyui.css" >
<link rel= "stylesheet" type= "Text/css" href= "Http://www.jeasyui.com/easyui/themes/icon.css" >
<script type= "Text/javascript" src= "Http://code.jquery.com/jquery-1.6.min.js" ></script>
<script type= "Text/javascript" src= "Http://www.jeasyui.com/easyui/jquery.easyui.min.js" ></script>
<script type= "Text/javascript" src= "Http://www.jeasyui.com/easyui/jquery.portal.js" ></script>
<body>
<p>this example shows how to build a simple portal system with floating panels.</p>
<div id= "pp" style= "width:700px;position:relative" >
<div style= "width:30%;" ></div>
<div style= "width:40%;" ></div>
<div style= "width:30%;" ></div>
</div>
<style type= "Text/css" >
. Demo-rtl. portal-column-left{
padding-left:10px;
padding-right:10px;
}
. Demo-rtl. portal-column-right{
padding-left:10px;
padding-right:0;
}
</style>
<script type= "Text/javascript" src= "/easyui/jquery.portal.js" ></script>
<script type= "Text/javascript" >
var panels = [
{id: ' P1 ', title: ' Tutorials ', height:200,collapsible:true,href: ' http://www.jeasyui.com/demo/main/portal_p1.html '} ,
{id: ' P2 ', title: ' Clock ', href: ' http://www.jeasyui.com/demo/main/portal_p2.html '},
{ID: ' p3 ', title: ' PropertyGrid ', Height:200,collapsible:true,closable:true,href: ' Http://www.jeasyui.com/demo/main /portal_p3.html '},
{ID: ' P4 ', title: ' DataGrid ', height:200,closable:true,href: ' http://www.jeasyui.com/demo/main/portal_p4.html '},
{ID: ' P5 ', title: ' Searching ', href: ' http://www.jeasyui.com/demo/main/portal_p5.html '},
{ID: ' P6 ', title: ' Graph ', href: ' http://www.jeasyui.com/demo/main/portal_p6.html '}
];
function GetCookie (name) {
var cookies = Document.cookie.split (';');
if (!cookies.length) return ';
for (var i=0; i<cookies.length; i++) {
var pair = cookies[i].split (' = ');
if ($.trim (pair[0]) = = name) {
Return $.trim (pair[1]);
}
}
Return ';
}
function getpaneloptions (ID) {
for (var i=0; i<panels.length; i++) {
if (panels[i].id = = ID) {
return panels[i];
}
}
return undefined;
}
function Getportalstate () {
var aa = [];
for (var columnindex=0; columnindex<3; columnindex++) {
var cc = [];
var panels = $ (' #pp '). Portal (' Getpanels ', columnindex);
for (var i=0; i<panels.length; i++) {
Cc.push (panels[i].attr (' id '));
}
Aa.push (Cc.join (', '));
}
Return Aa.join (': ');
}
function Addpanels (portalstate) {
var columns = portalstate.split (': ');
for (var columnindex=0; columnindex<columns.length; columnindex++) {
var cc = Columns[columnindex].split (', ');
for (var j=0; j<cc.length; J + +) {
var options = getpaneloptions (Cc[j]);
if (options) {
var p = $ (' <div/> '). attr (' id ', options.id). AppendTo (' body ');
P.panel (options);
$ (' #pp '). Portal (' add ', {
Panel:p,
Columnindex:columnindex
});
}
}
}
}
$ (function () {
$ (' #pp '). Portal ({
Onstatechange:function () {
var state = Getportalstate ();
var date = new Date ();
Date.settime (Date.gettime () + 24*3600*1000);
Document.cookie = ' portal-state= ' +state+ '; expires= ' +date.togmtstring ();
}
});
var state = GetCookie (' portal-state ');
if (!state) {
State = ' P1,P2:P3,P4:P5,P6 '; The default portal state
}
Addpanels (state);
$ (' #pp '). Portal (' resize ');
});
</script>
</body>
Portal---Easyui