/** * created by administrator on 2017/1/22. */ var serveurl = 'http://datapi.gzxx-group.com/'; // var serveurl = 'http://192.168.3.47:9134/'; (function() { var screen_width = $(window).width(); var screen_height = $(window).height(); $(".subcompany").bind("click", function() { if ($(this).children(".selectul").css("display") == "none") { $(this).children(".selectul").css("display", "block").removeclass("fadeoutin").addclass( "animated fadeindown"); } else { $(this).children(".selectul").removeclass("fadeindown").addclass("animated fadeoutin").css( "display", "none"); } }) $(".erweimabox").bind("click", function() { if ($(".erweima").css("display") == "none") $(".erweima").css("display", "block").addclass("animated fadeinup"); else $(".erweima").css("display", "none"); }); //计算contentbox的宽度 $(".navbar li").bind("click", function() { $(".navbar li").removeclass("active"); $(this).addclass("active"); $id = $(this).index(); $(".smallnav li:last-child").html($(this).html()); $(".page .subcontent").removeclass("active"); $(".page .subcontent").eq($id).addclass("active"); }) $(".menu li").bind("click", function() { $(".navbar li").removeclass("active"); $id = $(this).index(); $(".navbar li").eq($id).addclass("active"); $(".page .subcontent").removeclass("active"); $(".page .subcontent").eq($id).addclass("active"); $(".smallnav li:last-child").html($(this).html()); $('html,body').animate({ scrolltop: $('.navbar').offset().top + 4 }, 800); }) // 计算发展历程ul长度 var lilength = $(".bd ul li").length; $(".bd ul").css("width", lilength * 200 + "px"); var maxk = math.ceil(parseint($(".bd ul").css("width")) / 1200) - 1; var k = 0; $(".butn.next").bind("click", function() { k++; if (k <= maxk) { $(".bd ul").animate({ "left": "-=1200px" }, "slow"); } else { k = maxk; } }); $(".butn.prev").bind("click", function() { k--; if (k >= 0) { $(".bd ul").animate({ "left": "+=1200px" }, "slow"); } else { k = 0 } }); // 首页产品中心图标 $(window).bind("scroll", scroll = function(e) { var e = e || window.event; //获取event事件对象 var top = $(window).scrolltop(); var ptop = parseint($(".product").css("top")); if (ptop < 0 && top > 50) { $(".product").animate({ "top": "0px" }, 1000); $(window).unbind("scroll", scroll); } }) //展开更多列表 /* $(".showlist").bind("click",function () { var $this = $(this); var $parentnode=$($this[0].parentnode); var $li=$($parentnode.find(".newli")[0]); $parentnode.find("ul").append($li.clone()); $parentnode.find("ul").append($li.clone()); });*/ })(); function request(options) { // if (!options.hide) { // loadingshow() // } return new promise((resolve, reject) => { try { $.ajax({ type: options.type || 'get', url: serveurl + options.url, contenttype: options.contenttype || 'application/json', data: options.data, datatype: "json", success: function(data) { if (data.code == 500) { // toast('erro', '服务器异常...'); return; } resolve(data) }, error: function(data) { reject(data) settimeout(() => { // toast('erro', '服务器异常...') }, 500) } }) } catch (e) { console.log(e) settimeout(() => { // toast('erro', '服务器异常...') }, 500) } }); } //
function showfun(text) { var toast = document.getelementbyid('showtoast'); console.log(toast) if(!toast){ var html = document.createelement("div"); html.id = "showtoast"; document.body.appendchild(html); toast = document.getelementbyid('showtoast'); } toast.innertext = text; toast.style.display = "block"; settimeout(() => { toast.style.display = "none"; }, 2000) }