aa
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
|
||||
/* 弹出城市选择页面 */
|
||||
$(document).on("click",".open-about01", function () {
|
||||
$("input").blur()
|
||||
$("#citySearchInp").val("");
|
||||
$("#selectContainer").hide();
|
||||
$.popup(".popup-about01");
|
||||
$("p.close-popup").removeClass("collectionCity");
|
||||
$("p.close-popup").removeClass("active");
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url:BASE_PATH+"/quotations/loadCollectCitys",
|
||||
dataType:'json',
|
||||
success: function(data) {
|
||||
|
||||
var collects = data.collects;
|
||||
|
||||
$("p.close-popup").each(function(){
|
||||
var text = $(this).text();
|
||||
//设置关注城市
|
||||
if(collects){
|
||||
if(collects.indexOf(text)>-1){
|
||||
$(this).addClass("collectionCity");
|
||||
$(this).find("i").addClass("icon-collection03");
|
||||
}
|
||||
}
|
||||
|
||||
//设置当前城市选中
|
||||
if(typeof(curCity)!="undefined"){
|
||||
if(curCity && text == curCity){
|
||||
$(this).addClass("active");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/* 定位城市 */
|
||||
$("body").on("click", ".letter a", function () {
|
||||
var s = $(this).html();
|
||||
$(".popup-about01 .content").scrollTop(0);
|
||||
$(".popup-about01 .content").scrollTop($("#" + s + "1").offset().top - 106);
|
||||
});
|
||||
$("#tabCity1 .content-block01").scroll(function () {
|
||||
$("#tabCity1 .content-block01 .letter").css("position","absolute");
|
||||
$("#tabCity1 .content-block01 .letter").css("top", 85 - $("#cityContainer").position().top);
|
||||
});
|
||||
|
||||
/* 获取城市 */
|
||||
$(".popup-about01 .cityGPS").on("click", function () {
|
||||
$("#input_city").val($(this).find("p").text());
|
||||
$(".cityChoice a").text($(this).find("p").text());
|
||||
$(".popup-about01 p").removeClass("active");
|
||||
});
|
||||
$(".popup-about01 p").on("click", function () {
|
||||
$("#input_city").val($(this).text());
|
||||
$(".cityChoice a").text($(this).text());
|
||||
$(".popup-about01 p").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
});
|
||||
function req(city){
|
||||
city=city.replace("<i></i>","")
|
||||
$("#input_city").text(city);
|
||||
potenialIndex(city);
|
||||
}
|
||||
//城市选择
|
||||
//$("#cityCopy").html($('.tabs').html())
|
||||
var getAllCitys = function() {
|
||||
var list = new Array();
|
||||
$("#tabCity1 #cityContainer .city p").each(function(i, o) {
|
||||
list.push($(o).text());
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
var search = function(){
|
||||
var city = $("#citySearchInp").val();
|
||||
$("#selectContainer .city-list").empty();
|
||||
$("#selectContainer").show();
|
||||
|
||||
var cityList = getAllCitys();
|
||||
for(var i=0;i<cityList.length;i++) {
|
||||
if(cityList[i].indexOf(city) != -1){
|
||||
$("#selectContainer .city-list").append("<p class='close-popup' onclick=\"req('"+cityList[i]+"')\">"+cityList[i]+"</p>");
|
||||
}
|
||||
}
|
||||
|
||||
if(city == ""){
|
||||
$("#selectContainer").hide();
|
||||
}
|
||||
}
|
||||
|
||||
function req(city){
|
||||
city=city.replace("<i></i>","")
|
||||
$("#input_city").val(city);
|
||||
potenialIndex(city);
|
||||
}
|
||||
|
||||
$("#citySearchInp").bind('input propertychange keyup', function() {
|
||||
search();
|
||||
});
|
||||
|
||||
$("#citySearchInp").bind('keyup', function() {
|
||||
search();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user