Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
wtdmw committed Dec 29, 2018
1 parent 06ba29a commit 121bc76
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 22 deletions.
3 changes: 2 additions & 1 deletion html/splb.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,13 @@ <h3>流行话题</h3>
</div>
<!-- nav-end -->
</div>

<!-- header-end -->
<div class="splb_body">
<div class="splb_body_n">
<h3 class="splb_body_n_bt">全部</h3>
<div class="splb_body_n_jgkz">
价格:<input type="text"> - <input type="text"> <input type="button" value="确定">
价格:<input type="text" id="splb_qsj" value=""> - <input type="text" id="splb_wsj" value=""> <input type="button" value="确定" id="splb_qdpx">
</div>
<div class="splb_body_n_splb" id="splb_body_n_splb">

Expand Down
71 changes: 50 additions & 21 deletions js/splb.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,29 @@ function pbl_sjtc() {
sjts()
});


//循环数据数值 添加到页面
function sjts() {
$.each(arr, function (i, n) {
// console.log(n.zt)
var zt=n.zt.split(",") ;
var zt = n.zt.split(",");
$("#splb_body_n_splb").append(`
<div class="splb_body_n_splb_g">
<a href="${"http://"+window.location.host+"/html/xqy.html?id="+n.id}">
<div class="splb_body_n_splb_g_img">
<img src="${zt[0]}"
alt="">
</div>
<div class="splb_body_n_splb_g_bt">
<p>${n.bt}</p>
<div class="splb_body_n_splb_g">
<a href="${"http://"+window.location.host+"/html/xqy.html?id="+n.id}">
<div class="splb_body_n_splb_g_img">
<img src="${zt[0]}"
alt="">
</div>
<div class="splb_body_n_splb_g_bt">
<p>${n.bt}</p>
</div>
<div class="splb_body_n_splb_g_xx">
<span class="splb_body_n_splb_g_jg">¥<span id="splb_dqjg">${n.jg}</span></span>
<span class="splb_body_n_splb_g_yj">¥${n.yj}</span>
<span class="splb_body_n_splb_g_sc"><img src="//s18.mogucdn.com/p2/160908/upload_27g4f1ch6akie83hacb676j622b9l_32x30.png"
alt=""> ${n.scs}</span>
</div>
</a>
</div>
<div class="splb_body_n_splb_g_xx">
<span class="splb_body_n_splb_g_jg">¥${n.jg}</span>
<span class="splb_body_n_splb_g_yj">¥${n.yj}</span>
<span class="splb_body_n_splb_g_sc"><img src="//s18.mogucdn.com/p2/160908/upload_27g4f1ch6akie83hacb676j622b9l_32x30.png"
alt=""> ${n.scs}</span>
</div>
</a>
</div>
`)
`)
});
}

Expand All @@ -56,4 +54,35 @@ $(window).scroll(function (event) {
pbl_sjtc();
}

});
});

$("#splb_qdpx").click(function () {
splb_jgsx();
pbl_sjtc();
});

//价格筛选
function splb_jgsx() {
//最小价格
var zx = $("#splb_qsj").val() * 1;
//最大价格
var zd = $("#splb_wsj").val() * 1;

//大小检擦
if (zd < zx) {
var x = zx;
zx = zd;
zd = x;
}

//循环商品列表将不符合条件的隐藏
$.each($(".splb_body_n_splb_g"), function (i, n) {
//当前商品价格
var dj = $(n).find("#splb_dqjg").text() * 1
if (dj < zx || dj > zd) {
$(n).css("display", "none");
} else {
$(n).css("display", "inline-block");
}
});
}

0 comments on commit 121bc76

Please sign in to comment.