Skip to content

Commit 7060558

Browse files
committed
Small improvements of the mobile version
1 parent dcb4527 commit 7060558

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<link rel="stylesheet" href="codemirror-5.47.0/lib/codemirror.css">
99
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
1010
rel="stylesheet">
11+
<meta name="viewport" content="width=400" />
12+
<meta name="description" content="Traducteur de langage naturel vers du Python">
1113
</head>
1214
<body>
1315
<header>

scripts.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ function writeCode(){
9999
}
100100
}
101101
function toggleMenu(){
102+
if ($( window ).scrollTop() > $("header").outerHeight()) {
103+
$("nav").css({
104+
top: 0
105+
})
106+
} else{
107+
$("nav").css({
108+
top: $("header").outerHeight()-$( window ).scrollTop() //Makes the menu stick the header
109+
})
110+
}
102111
$("nav").animate({
103112
left: parseInt($("nav").css('left'),10) == 0 ? -$("nav").outerWidth() : 0
104113
});
@@ -108,4 +117,20 @@ $(function() {
108117
writeCode();
109118
//Making sure everithing is coordinated in the ouput
110119
$("#output .swicher").val("text")
120+
});
121+
$( window ).resize(function() {
122+
$("nav").css({
123+
top: $("header").outerHeight()
124+
})
125+
});
126+
$( window ).scroll(function() {
127+
if ($( window ).scrollTop() > $("header").outerHeight()) {
128+
$("nav").css({
129+
top: 0
130+
})
131+
} else{
132+
$("nav").css({
133+
top: $("header").outerHeight()-$( window ).scrollTop() //Makes the menu stick the header
134+
})
135+
}
111136
});

style.css

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
@import url('https://fonts.googleapis.com/css?family=Noto+Sans+HK:300&display=swap');body{
22
font-family: 'Noto Sans HK', sans-serif;
33
}
4-
body,html{
4+
body, html{
55
background-color: whitesmoke;
66
padding: 0px;
77
margin: 0px;
8+
min-width: 360px;
89
}
910
#menu-openner{
1011
position: absolute;
@@ -20,11 +21,11 @@ body,html{
2021
font-size: 40px;
2122
}
2223
nav{
23-
position: absolute;
24-
top: 69px;
24+
position: fixed;
25+
top:0px;
2526
z-index: 1000;
2627
background-color: white;
27-
height: calc(100vh - 69px);
28+
height:100vh;
2829
width: 300px;
2930
border: 1px #cbcb solid;
3031
box-shadow: 2px 2px 10px silver;
@@ -180,14 +181,19 @@ h2{
180181
display: block;
181182
}
182183
#inputArea, #outputArea{
183-
width: 100%;
184+
width: 90%;
185+
margin: auto;
184186
}
185187
}
186-
@media screen and (max-width: 500px){
188+
@media screen and (max-width: 600px){
187189
h1{
188190
font-size: 25px;
189191
}
190192
h1 img{
191193
height: 35px;
192194
}
195+
section{
196+
padding: 0px;
197+
width: 100%;
198+
}
193199
}

0 commit comments

Comments
 (0)