2016-04-04 1 views
0
私は2つのサイドパネル(panel_Leftとpanel_Right)のみ 場合(window.innerWidth> 800)が、常には一つだけ

オープン左右のサイドパネルの場合(window.innerWidth> 800)

オープンパネルとすることを開きたい

window.onresize = function (event) { 
    if (window.innerWidth > 800) { 
     window.setTimeout(openPanel, 1); 
    } 
    if (window.innerWidth < 800) { 
     window.setTimeout(closePanel, 1); 
    } 
}; 


function closePanel() { 
    $("Panel_left").panel("close"); 
    $("#Panel_right").panel("close"); 
} 

function openPanel() { 
    $("#Panel_left").panel("open"); 
    $("#Panel_right").panel("open"); 
} 


$("#Panel_left").on("panelcreate", function (event, ui) { 
    if (window.innerWidth > 800) { 
     openPanel(); 
    } 
    if (window.innerWidth < 800) { 
     closePanel(); 
    } 
}); 

を私が使用知る(jquery.mobile-1.4.5.min.js)

+0

@moバイ?これが必要なのでしょうか? –

+0

テキスト追加注文やフォーマットがそう**本当に それは私が何をしたいです** – iberbeu

答えて

0

window.onresize = function(event) { 
 
    if (window.innerWidth > 800) { 
 
     console.log("hi"); 
 
     document.getElementById("left").style.display = "block"; 
 
     document.getElementById("right").style.display = "block"; 
 
     // window.setTimeout(openPanel, 1); 
 
    } else { 
 
     document.getElementById("right").style.display = "none"; 
 
     document.getElementById("left").style.display = "none"; 
 
     console.log("hello"); 
 
     // window.setTimeout(closePanel, 1); 
 
    } 
 
}; 
 
window.onload = function() { 
 
    if (window.innerWidth > 800) { 
 
     console.log("hi"); 
 
     document.getElementById("left").style.display = "block"; 
 
     document.getElementById("right").style.display = "block"; 
 
     // window.setTimeout(openPanel, 1); 
 
    } else { 
 
     document.getElementById("right").style.display = "none"; 
 
     document.getElementById("left").style.display = "none"; 
 
     console.log("hello"); 
 
     // window.setTimeout(closePanel, 1); 
 
    } 
 
}
#left, 
 
#right { 
 
    width: 10%; 
 
    display: inline-block; 
 
} 
 

 
#left { 
 
    float: left; 
 
} 
 

 
#right { 
 
    float: right; 
 
}
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <title>stack</title> 
 
    
 
    <link rel="stylesheet" type="text/css" href="style.css"> 
 
</head> 
 

 
<body> 
 
    <div id="left">hi</div> 
 
    <div id="right">hello</div> 
 
    <script type="text/javascript" src="controller.js"></script> 
 
</body> 
 

 
</html>

はあなたがここにHTMLを追加することができます

+0

を改善**だから、助けてくれてありがとう。** –

+0

あなたが.can歓迎:)ある私の答えの横にアップ矢印ボタンをクリックしてください? – Batman

+0

あなたは大歓迎です... はいいいえ –

関連する問題