/* * @author: wenyu * @date: 2017-01-11 17:14:13 * @last modified by: wenyu * @last modified time: 2017-01-11 17:14:17 */ /* * lsl 楼层事件 */ $(function() { $(".m-floorlable").each(function(index){ $(this).removeclass("y_inflor1").addclass("y_inflor"+(index+1)); $(this).attr("data-flor",index+1); }); $('.y_florfix').html(""); $('.y_catatit').each(function(i){ var num = number(i) + 1; var floorname = $(this).children().children('strong').text(); var showname=$(this).find("span").text(); if(showname==''){ showname=floorname; } $('.y_florfix').append(''+showname+''); }); ltflorshow(); $(window).resize(function(){ ltflorshow(); }); function ltflorshow(){ var boxwidth=$(".container").width(), winwidth=$(window).width(); if((winwidth/2-boxwidth/2)<77){ $(".y_florfix").show(); }else{ $(".y_florfix").show(); }; }; $(window).scroll(function() { $("[data-flor]").each(function(){ var whei=$(window).height()/2; var list1=$(this).attr("data-flor"); var opt1=$(".y_inflor"+list1).offset().top-whei; if ($(window).scrolltop() >= opt1) { $(".y_florfix span").eq(list1-1).addclass("y_active").siblings().removeclass("y_active"); } }); if($(window).scrolltop() >= 200){ if(!$('.y_florfix').hasclass("y_fixshow")){ $('.y_florfix').addclass("y_fixshow"); } }else{ if($('.y_florfix').hasclass("y_fixshow")){ $('.y_florfix').removeclass("y_fixshow"); } }; }); $(".y_florfix span").click(function(){ $(this).addclass("y_active"); var list=$(this).attr("data-fix"); var ltop=$(".y_inflor"+list).offset().top-55; $("html,body").animate({scrolltop:ltop},300); }); }); /* * lsl 楼层事件 */