-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
105 lines (99 loc) · 3.39 KB
/
index.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
<?php
include $_SERVER["DOCUMENT_ROOT"]."/include/db.php";
include $_SERVER["DOCUMENT_ROOT"]."/include/header.php";
$main = array();
$sub = array();
$sql = " select * from category order by main asc ";
$rs = $pdo -> prepare($sql);
$rs -> execute();
while($row = $rs -> fetch()) {
if($row["sub"] == 0)
$main[] = $row;
else
$sub[] = $row;
}
?>
<section id="main">
<div class="contents">
<h2><span class="font_EB">헬푸미</span>가 원하시는 제품을 찾아드릴게요.</h2>
<div class="search">
<input id="word" placeholder= "입력하신 단어를 포함한 제품을 찾습니다.">
</div>
<div class="category">
<ul class="w100">
<?php
foreach($main as $m) {
?>
<li>
<div class="selectable" data-idx="<?php echo $m['main']; ?>">
<?php echo '<img src="/img/category'.$m['idx'].'.png" alt="category'.$m['idx'].'.png" title="'.$m['name'].'">'; ?>
<?php echo '<img src="/img/category'.$m['idx'].'_.png" alt="category'.$m['idx'].'_.png" title="'.$m['name'].'">'; ?>
</div>
<p><?php echo $m["name"]; ?></p>
</li>
<?php
}
?>
</ul>
</div>
<div class="price">
<div class="slider"></div>
<span class="minPrice">\10000</span>
<span class="maxPrice">\90000</span>
</div>
<div class="tag">
<ul>
<?php
foreach($sub as $s) {
?>
<li class="hover_in_white selectable" data-main="<?php echo $s['main']; ?>"><?php echo $s["name"]; ?></li>
<?php
}
?>
</ul>
</div>
<div class="submit">
<a href="#" class="hover_in_white">완료</a>
</div>
</div>
</section>
</div>
<script>
$(function() {
// on(".category .selectable", "click", function() {
// $(".tag .selectable").removeClass("selected").hide();
// $(".tag .selectable[data-main='"+ $(this).attr("data-idx") +"']").show();
// });
//
// on(".selectable", "click", function() {
// $(this).toggleClass("selected");
// if($(this).hasClass("selected"))
// $(this).removeClass("selected");
// else
// $(this).addClass("selected");
// });
// $(".category .selectable").eq(0).click();
var maxPrice = 100000;
$(".price .slider").slider({
range: true,
min: 0,
max: maxPrice,
values: [10000, 90000],
step: 5000,
slide: function(event, ui) {
var handleIdx = ui.handleIndex;
var curValue = ui.value;
var text;
if(curValue == 0) text = "최소가격";
else if(curValue == maxPrice) text = "최대가격";
else text = "\\" + curValue;
$(".price > span").eq(handleIdx).css({
"left": "calc("+(curValue / maxPrice * 100)+"% - 9%)"
}).text(text);
}
});
});
</script>
<?php
include $_SERVER["DOCUMENT_ROOT"]."/include/footer.php";
?>