123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- $(function(){
-
- //自适应窗口
- document.documentElement.style.fontSize=24*( (document.documentElement.clientWidth)/360 )+"px";
- window.onorientationchange=function(){document.documentElement.style.fontSize=24*( (document.documentElement.clientWidth)/360 )+"px";}
-
-
-
- $(".appBar div:eq(1)").click(function () {
- $.cookie("new_app_guide_cookie","true",{expires:1,path:"/"});
- $(".fixBox.app").hide();
- });
-
- //条件点击选中
- $(".term span").click(function(){
- $(this).parent().find("span").removeClass("on");
- $(this).addClass("on")
- })
-
- //条件展开
- $(".searchRow div").click(function(){
- if($(this).parent().attr("class")=="searchRow ar"){
- $(this).parent().css({"height":"auto"});
- $(this).parent().removeClass("ar").addClass("br");
- }else{
- $(this).parent().css({"height":"1.82rem"});
- $(this).parent().removeClass("br").addClass("ar");
- }
- })
-
- //城市点击
- $("#cityList").click(function(){
- // window.location.href = "/city/cityList";
- shadeLayer()
- $(".popCity").css("display","block");
- })
- $(".cancelRow").click(function(){
- $(".popCity").css("display","none");
- $(".shadeLayer").remove();
- })
-
- //输入框
- $(".searchInput").focus(function(){
- if($(this).val()=="输入小区/地址" || $(this).val()=="输入内容"){
- $(this).val("")
- $(this).css("color","#000");
- }
- })
-
- //点击搜索
- // $(".searchBar input").click(function(){
- // if( $(".popSearch").css("display")=="none" ){
- //
- // $(".popSearch").css("display","block");
- // shadeLayer(this.name)
- // }
- //
- // })
- $(".popSearch").click(function(){
- $(".popBox").css("display","none")
- $(".shadeLayer").remove();
-
- if(!$(".searchInput").val()){
- $(".searchInput").val("输入小区/地址")
- $(".searchInput").css("color","#999");
- }
- })
-
- $(".popSearch li").click(function(event){
- $(".searchBar input").val($(this).text())
- $(".searchBar input").css("color","#000")
- //event.stopPropagation();
- //$(".popBox").css("display","none")
- // $(".shadeLayer").remove();
- })
-
- //输入框清除按钮
- // $(".deleteBtn").click(function(){
- // $(this).next().val("");
- // })
-
- //点击选中
- $(".term span").click(function(){
- $(this).parent().find("span").removeClass("on");
- $(this).addClass("on")
- })
-
-
- //分享弹层
- $(".share").click(function(){
- shadeLayer();
- $(".shares").css("display","block");
- $(".shareBox").removeClass("bdshare-button-style0-16");
- })
-
- $(".cancelRow").click(function(){
- $(".shadeLayer").remove();
- $(".popBox").css("display","none");
- })
-
- //详情页描述文字点击展开
- $(".description #expand").toggle(function(){
- $(".description #dBox").removeClass("cBox");
- $(".description #dBox").addClass("openBox");
- $(this).html("[收起]");
- $(this).animate({ scrollTop: 0 }, 300);
- }, function() {
- $(".description #dBox").removeClass("openBox");
- $(".description #dBox").addClass("cBox");
- $(this).html("[展开]");
- $(this).animate({ scrollTop: 0 }, 300);
- })
-
-
- //滚动图片
- if(document.body.className=="photo" || document.body.className=="sale"){
- var oUl=document.getElementById("photoUl");
- var aLi=oUl.getElementsByTagName("li");
-
- function photoMove(){
- $(".photoTab ul:eq(0)").animate({"left":-$(".photoTab ul:eq(0) li").width()*(photoIndex-1)},200);
- $(".photoDot p span").removeClass("on");
- $(".photoDot p span").eq(photoIndex-1).addClass("on");
- }
-
- var photoIndex=1;
-
- /*setInterval(function(){
-
- if(photoIndex<$(".photoTab ul:eq(0) li").length){ photoIndex++; }
- else{ photoIndex=1 }
-
- photoMove();
- },4000)*/
-
- oUl.ontouchstart=function(ev){
- var oldLeft=oUl.offsetLeft;
- var ev=ev||window.event;
- var disX=ev.changedTouches[0].clientX-oUl.offsetLeft;
-
- document.ontouchmove=function(ev){
- var ev=ev||window.event;
- oUl.style.left=ev.changedTouches[0].clientX-disX+"px";
- if(oUl.offsetLeft>0) oUl.style.left=0+"px";
- if(oUl.offsetLeft<-(aLi[0].offsetWidth*(aLi.length-1))) {
- oUl.style.left=-(aLi[0].offsetWidth*(aLi.length-1))+"px";
- }
-
- return false;
- }
-
- document.ontouchend=function(){
- var distance=oldLeft-oUl.offsetLeft
- if(distance>0){
- photoIndex++;
- photoMove();
- }else if(distance<0){
- photoIndex--;
- photoMove();
- }
-
- document.ontouchmove=null;
- document.ontouchend=null;
- }
- }
- }
-
-
- //返回顶部
- $(".gotoTop").click(function(){
- $('body,html').animate({ scrollTop: 0 }, 300)
- })
-
- $(window).scroll(function(){
- if($(window).scrollTop()>300){
- $(".gotoTop").css("display","block");
- }
- else if($(window).scrollTop()<300){
- $(".gotoTop").css("display","none");
- }
- })
-
- })
- //半透明弹层
- function shadeLayer(top){
- var oShade=$("<div>")
- if(!top) top=0;
- oShade.css({
- "width":"100%",
- "height":$(document.body).outerHeight(true),
- "position":"absolute",
- "top":top,
- "background":"rgba(0,0,0,0.3)",
- "z-index":"5"
- })
- oShade.attr("class","shadeLayer");
- oShade.click(function(){
- oShade.remove()
- $(".popBox").css("display","none");
- })
- $("body").append(oShade);
- }
- $(".popBox").click(function(even){
- event.stopPropagation();
- })
|