-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader1.php
More file actions
104 lines (100 loc) · 2.91 KB
/
Copy pathheader1.php
File metadata and controls
104 lines (100 loc) · 2.91 KB
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
<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search Sub Categories</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
/* Navbar Styling */
.navbar {
background-color: #333;
overflow: hidden;
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
}
.navbar a {
color: white;
text-decoration: none;
padding: 14px 20px;
}
.search-container {
display: flex;
align-items: center;
}
.search-container input {
padding: 7px;
margin-right: 5px;
border: none;
border-radius: 3px;
}
.search-container button {
background-color: #e3007b;
color: white;
padding: 7px 10px;
border: none;
cursor: pointer;
border-radius: 3px;
}
/* Search Results Dropdown */
#search-results {
position: absolute;
background: white;
width: 250px;
border: 1px solid #ddd;
max-height: 200px;
overflow-y: auto;
display: none;
z-index: 1000;
}
#search-results li {
list-style: none;
padding: 10px;
border-bottom: 1px solid #ddd;
cursor: pointer;
}
#search-results li:hover {
background-color: #f1f1f1;
}
</style>
</head>
<body>
<div class="navbar">
<a href="category1.php">Home</a>
<div class="search-container">
<input type="text" id="search-box" placeholder="Search sub-category...">
<button id="search-btn"><i class="fa fa-search"></i></button>
<ul id="search-results"></ul> <!-- Search results will appear here -->
</div>
</div>
<script>
$(document).ready(function () {
$("#search-box").on("keyup", function () {
var query = $(this).val();
if (query.length > 1) {
$.ajax({
url: "get_filter_data_ajax.php",
type: "GET",
data: { search: query },
success: function (data) {
$("#search-results").html(data).show();
}
});
} else {
$("#search-results").hide();
}
});
// Hide search results when clicking outside
$(document).on("click", function (e) {
if (!$(e.target).closest("#search-box, #search-results").length) {
$("#search-results").hide();
}
});
});
</script>
</body>
</html>