init
This commit is contained in:
155
app/index/view/group/search.phtml
Executable file
155
app/index/view/group/search.phtml
Executable file
@@ -0,0 +1,155 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{include file="include/head-product" /}
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/web/css/subject/search.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--top-->
|
||||
{include file="include/top-product" /}
|
||||
<!--top End-->
|
||||
<div class="S-search-bg banner-other nsea">
|
||||
<div class="swt-Container-1200 S-search-content secon1">
|
||||
<div class="S-Searchbox">
|
||||
<div class="Search">
|
||||
<input type="text" name="textfield" class="ipt" placeholder="硬盘盒" id="search-in">
|
||||
<button type="submit" name="button" value="" class="searchbtn icon-search" id="search-btn"></button>
|
||||
<div id="search" class="search_content search_default">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="sput">
|
||||
<input value="dfdff" placeholder="站内搜索" id="search-input" type="text">
|
||||
<a href="javascript:void(0);" id="search-button"><img src="/frontend/web/images/images/sea1.png"></a>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- bottom s -->
|
||||
{include file="include/bottom2023" /}
|
||||
<!-- bottom e -->
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$.ajax({
|
||||
url: '/index/product/get_filter',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
var data = res.data.product_name;
|
||||
var html = '<ul>';
|
||||
data.forEach((item, index) => {
|
||||
html += '<li>';
|
||||
html += item.name + '(' + item.brand_id + ')';
|
||||
html += '</li>';
|
||||
})
|
||||
html += '</ul>';
|
||||
$('#search').html(html);
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
// NEW selector
|
||||
jQuery.expr[':'].Contains = function(a, i, m) {
|
||||
return jQuery(a).text().toUpperCase()
|
||||
.indexOf(m[3].toUpperCase()) >= 0;
|
||||
};
|
||||
// OVERWRITES old selecor
|
||||
jQuery.expr[':'].contains = function(a, i, m) {
|
||||
return jQuery(a).text().toUpperCase()
|
||||
.indexOf(m[3].toUpperCase()) >= 0;
|
||||
};
|
||||
//Update to work for jQuery 1.8
|
||||
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
|
||||
return function( elem ) {
|
||||
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
|
||||
};
|
||||
});
|
||||
|
||||
$(function() {
|
||||
var search_input = $(".Search input");
|
||||
var search_content = $(".search_content");
|
||||
$(search_input).on("keyup", function() {
|
||||
if (search_input.val().length > 0) {
|
||||
$(search_content).show().addClass("ul_add");
|
||||
}
|
||||
else if (search_input.val().length == 0) {
|
||||
$(search_content).show().removeClass("ul_add");
|
||||
}
|
||||
|
||||
|
||||
//$(".search_content li:contains(" + search_input.val().trim() + ")").show();
|
||||
//$(".search_content li:not(:contains(" + search_input.val().trim() + "))").hide();
|
||||
|
||||
$(".search_content li").hide().filter(":contains("+ search_input.val().toLowerCase().trim() +")").show();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#search ul li").live('click',function(){
|
||||
//console.log(11111);
|
||||
//获取点击的值
|
||||
var keywords = $(this).text();
|
||||
|
||||
if(keywords) {
|
||||
$('#search-in').val(keywords);
|
||||
var href = "<?php echo url('/search'); ?>?skeyword=" + encodeURIComponent(keywords);
|
||||
location.href = href;
|
||||
$(".search_content").hide();
|
||||
}
|
||||
});
|
||||
|
||||
//点击search以外部分隐藏
|
||||
$("body").click(function (e) {
|
||||
if (!$(e.target).closest(".Search").length) {
|
||||
$(".search_content").hide()
|
||||
}
|
||||
//console.log(111);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
/*定位光标*/
|
||||
document.querySelector('#search-in').focus();
|
||||
|
||||
|
||||
$(function() {
|
||||
//
|
||||
$("#search-btn").bind("click", function(event) {
|
||||
var skeyword = $("#search-in").val();
|
||||
if (skeyword) {
|
||||
var href = "<?php echo url('/search'); ?>?skeyword=" + encodeURIComponent(skeyword);
|
||||
location.href = href;
|
||||
}
|
||||
});
|
||||
$("#search-in").keyup(function(event) {
|
||||
if (event && event.keyCode === 13) {
|
||||
$("#search-btn").trigger("click");
|
||||
}
|
||||
});
|
||||
var $category = $(".navlist");
|
||||
$category.hide();
|
||||
$(".navul li").mouseleave(function() {
|
||||
$(this).children("a").addClass("aons");
|
||||
$(this).children("dl").stop(true, true).slideUp(500);
|
||||
|
||||
});
|
||||
$(".navul li").mouseenter(function() {
|
||||
$category.hide();
|
||||
$(this).children("dl").stop(true, true).slideDown(500);
|
||||
});
|
||||
//搜索框
|
||||
$(".Searchbox .icon").click(function() {
|
||||
$(".Search").slideToggle();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user