function getDate(sep='-'){ var myDate = new Date(); return myDate.getFullYear()+sep+(myDate.getMonth()+1)+sep+myDate.getDate(); } $(function (){ var myDate = new Date(); $('.line1 .datenow').text(getDate()) $(".login-content .select-input").click(function(){ $(".login-content .select-input .muchang-list").toggle(); }) $(".login-content .select-input .muchang-list li").on("click",function(){ var title = $(this).text(); $(".login-content .select-input .muchang-title").text(title); }) var poly = $(".header-wrapper .title svg polygon"); var coorddd = "0,0 75,100 114,100 135,82 765,82 786,100 825,100 900,0";//原坐标 var t_width = $(".header-wrapper .title").width(); var svg = $(".header-wrapper .title svg"); var y_width = svg.attr('width');//原来的宽度 var h_width = t_width + 280;//后来的宽度 var c_width = h_width - y_width;//相差多少宽度 svg.attr('width',h_width); var cood_arrs = coorddd.split(' '); var af_coodarrs = []; for(var i = 0;i<8;++i){ if(i>=4){ var cood = cood_arrs[i].split(','); cood[0] = parseInt(cood[0])+c_width;//坐标相应调整相差的宽度 cooo = cood.join(','); af_coodarrs[i] = cooo; }else{ af_coodarrs[i] = cood_arrs[i]; } } var af_coods = af_coodarrs.join(' '); poly.attr('points',af_coods); //console.log(af_coods) //console.log(cood_arrs) })