-
Notifications
You must be signed in to change notification settings - Fork 0
/
__nav.php
119 lines (97 loc) · 4.75 KB
/
__nav.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<body>
<header>
<div class="container">
<div class="row justify-content-between align-items-end mobile-style">
<div class="d-flex head_mobile">
<div class="logo px-2 show_destop"><a href="index.php"><img src="img/logo.svg" alt=""></a></div>
<div class="logo px-2 show_mobile "><a href="index.php"><img src="img/logo_m.svg" alt=""></a></div>
</div>
<div class="features pb-2">
<form method="post" action="" onsubmit="return false">
<div class="serbox">
<input id="mag" type="search" placeholder=" Search..." name="search">
<div id="arm"></div>
</form>
<a href="cart.php" class="cart"><img src="img/icon/shop.svg" alt="購物車" class="px-3 ml-2 shop">
<span class="badge badge-pill badge-warning cart-qty"></span>
</a>
<?php if (isset($_SESSION['loginUser'])) : ?>
<div style="width:80px;" class="mber">
<a id="my_nickname" href="mber_profile.php"><?= $_SESSION['loginUser']['nickname'] ?></a>
</div>
<?php else : ?>
<a href="A_login.php"><img src="img/icon/會員.svg" alt="會員中心" class="px-2"></a>
<?php endif ?>
<!-- <a href="A_login.php"><img src="img/icon/會員.svg" alt="會員中心" class="px-2"></a> -->
<div class="menu transition show_mobile ">
<div class="bar bar1 transition"></div>
<div class="bar bar2 transition"></div>
<div class="bar bar3 transition"></div>
<ul class="transition">
<li><a href="" class="transition"></a></li>
<li><a href="canon.php" class="transition">CANON</a></li>
<li><a href="nikon.php" class="transition">NIKON</a></li>
<li><a href="leica.php" class="transition">LEICA</a></li>
<li><a href="product-list.php" class="transition">產品列表</a></li>
<li><a href="diy.php" class="transition">首選推薦</a></li>
<li><a href="profile_share.php" class="transition">攝影分享</a></li>
<li><a href="A_aboutus.php" class="transition">關於我們</a></li>
<li><a href="A_service.php" class="transition">客服支援</a></li>
</ul>
</div>
</div>
</div>
</div>
</header>
<nav>
<div class="container">
<div class="d-flex justify-content-between">
<ul class="d-flex nav-l">
<li><a href="index.php">首頁</a></li>
<li><a href="canon.php" class="deskshow">CANON</a></li>
<li><a href="nikon.php" class="deskshow">NIKON</a></li>
<li><a href="leica.php" class="deskshow" style="letter-spacing:1px;">LEICA</a></li>
<li><a href="product-list.php">產品列表</a></li>
<li><a href="diy.php">首選推薦</a></li>
<li><a href="profile_share.php">攝影分享</a></li>
</ul>
<ul class="d-flex nav-r">
<li><a href="A_aboutus.php">關於我們</a></li>
<li><a href="A_service.php">客服支援</a></li>
</ul>
</div>
</div>
</nav>
<div class="space"></div>
<script>
function calcQty(cart_data) {
var sum = 0;
for (let s in cart_data) {
sum += cart_data[s];
}
// var cartQty=$('.cart-qty').text();
if (cart_data == '') {
$('.cart-qty').hide();
// console.log('0000000000')
} else {
$('.cart-qty').show();
// console.log('11111111111')
$('.cart-qty').text(sum);
}
}
$.get('add_to_cart.php', function(data) {
calcQty(data);
}, 'json');
// // $(".cart-qty").hide();
// var cartNum= $(".cart-qty");
// // $(".cart-qty").hide();
// if(cartNum.innerText =0){
// $(".cart-qty").hide();
// }
$("#mag").keypress(function(event) {
if (event.keyCode == 13) {
var data = $("#mag").val()
location.href = 'product-list.php?search=' + data;
}
})
</script>