-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmobile.php
98 lines (72 loc) · 2.35 KB
/
mobile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
* Created by PhpStorm.
* User: Nirjhor
* Date: 11/6/2018
* Time: 4:53 AM
*/
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.warningDisplay {
display: none;
}
#warningDisplay_for_desktop {
display: none;
}
/* @media only screen and (min-width: 768px) {
.warningDisplay_for_desktop {
display: inline-block;
}
}*/
@media screen and (orientation: portrait) {
.warningDisplay {
display: inline-block;
}
}
@media screen and (orientation: landscape) {
.warningDisplay {
display: none;
}
}
</style>
</head>
<body>
<div class="container">
<h2>Alerts</h2>
<div class="alert alert-success alert-dismissible fade in warningDisplay">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Please !</strong> Go back to <strong>Landscape Mood.</strong>
</div>
<div class="alert alert-success alert-dismissible fade in " id="warningDisplay_for_desktop">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Please !</strong> Go to <strong>Mobile Mood.</strong>
</div>
</div>
<script type="text/javascript">
var test = function () {
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
var element = document.getElementById('warningDisplay_for_desktop');
if (isMobile) {
//element.innerHTML = "You are using Mobile";
element.style.display = "none";
//alert('Mobile');
} else {
//element.innerHTML = "You are using Desktop";
//alert('desktop');
element.style.display = "inline-block";
}
}
window.onload = test;
window.onresize = test;
</script>
</body>
</html>