var ismobile = false, mobile = false, win_width = 0, win_height = 0, navitem = 0, ath = 90, $menubtn = jquery('.menu-handler'), $menuoverlay = jquery('.menu-overlay'), menum = jquery(".menumoblie"), pagenavnum = 0, scrollnav = 0; var pageinit = { init: function() { win_width = $(window).width(); win_height = $(window).height(); if (win_width <= 1200) { ismobile = true; ath = 54; } else if (win_width > 1200) { ismobile = false; ath = 86; menu.close(); }; }, setimgmax: function(img, imgw, imgh, tw, th) { var twidth = tw || win_width; var theight = th || win_height; var coe = imgh / imgw; var coe2 = theight / twidth; if (coe < coe2) { var imgwidth = theight / coe; img.css({ height: theight, width: imgwidth, left: -(imgwidth - twidth) / 2, top: 0 }); } else { var imgheight = twidth * coe; img.css({ height: imgheight, width: twidth, left: 0, top: -(imgheight - theight) / 2 }); }; }, setscroll: function(anchorcur) { if (jquery(anchorcur).length >= 1) { jquery("html,body").animate({ scrolltop: jquery(anchorcur).offset().top - ath }, 0); } }, setermbox: function(obj, title) { obj.click(function() { var str = '
' + title + '
'; $("body").append(str); jquery(".ermsblack").fadein(); jquery(".ermsbox").animate({ margintop: "-132" }, 400); $(".ermsbox .close").click(function() { $(".ermsblack").remove(); }); jquery(".ermsblack").click(function() { $(".ermsblack").remove(); }); return false; }) }, setsplit: function(el) { var n = el; for (var e = 0, t = n.length; e < t; e++) { var a = n[e], r = a.textcontent.trim(); a.innerhtml = ""; i(a, r) } function i(n, e) { for (var t in e) { var a = document.createelement("span"); a.innerhtml = e[t] === " " ? " " : e[t]; n.appendchild(a); } } }, settimedelay: function(el, time, delay, reverse) { var _span = el; _span.each(function(i) { var _i = $(this).find('span'); _i.each(function(j) { if (reverse) { j = _i.length - j - 1; } $(this).css({ 'animation-delay': delay + time * j + 'ms', '-webkit-animation-delay': delay + time * j + 'ms' }) }) }) }, showbox: function(htmladdress) { $.ajax({ url: htmladdress, datatype: "html", success: function(data) { if (data == "" || data == null) { return; } else { if (jquery(".md-modal").length >= 1) { jquery('html').removeclass('md-show'); jquery('.md-modal').remove(); }; $("body").append( '
' ); $('.md-modal .vertical-inner').append(data); settimeout(function() { $("html").addclass("md-show"); }, 50); jquery('.form-box-close').bind('click', function(e) { jquery('html').removeclass('md-show'); settimeout(function() { jquery('.md-modal').remove(); }, 400); }); jquery('.md-modal .vertical-inner').bind('click', function(e) { if ($(e.target).hasclass('vertical-inner')) { jquery('html').removeclass('md-show'); settimeout(function() { jquery('.md-modal').remove(); }, 400); } }); } }, error: function(xmlhttprequest, textstatus, errorthrown) { jquery('html').removeclass('md-show'); settimeout(function() { jquery('.md-modal').remove(); }, 400); } }); }, pbanner: function() {} }, nav = { init: function() {} }, menu = { init: function() { jquery(".menu-handler").click(function() { if (navitem == 0) { jquery(this).addclass("active"); jquery("html").addclass("menuopen"); navitem = 1; } else { jquery(this).removeclass("active"); jquery("html").removeclass("menuopen"); navitem = 0; } }); $(document).on("click", ".menumoblie .nav-link", function(e) { var mnavcur = $(this); var mnavbox = $(this).parents("li"); if (mnavbox.find(".subnav").length > 0) { if (mnavbox.hasclass("cur")) { mnavbox.find(".subnav").stop(false, false).slideup(); mnavbox.removeclass("cur"); } else { jquery(".menumoblie li").removeclass("cur"); jquery(".subnav").stop(false, false).slideup(); mnavbox.find(".subnav").stop(false, false).slidedown(); mnavbox.addclass("cur"); e.preventdefault(); } } }); $(document).on("click", ".menumoblie a", function(e) { var $this = jquery(this); var hash = $this.attr("href").split("#")[1]; if (hash && jquery("#" + hash).length >= 1) { e.preventdefault(); jquery("html,body").animate({ scrolltop: jquery("#" + hash).offset().top - ath }, 0); menu.close(); } }); $(".pusher-black").click(function() { if (navitem == 1) { menu.close(); }; }); }, close: function() { $menubtn.removeclass("active"); jquery("html").removeclass("menuopen"); navitem = 0; } }, pbanner = { init: function() {} }, pagenav = { init: function() { jquery(".dw").click(function(e) { $(this).parents().find(".iw2menu").addclass('active'); $(this).addclass("active").siblings().removeclass('active'); var $this = jquery(this); var hash = $this.attr("href").split("#")[1]; if (hash && jquery("#" + hash).length >= 1) { e.preventdefault(); jquery("html,body").animate({ scrolltop: jquery("#" + hash).offset().top - ath }, 600, 'easeinoutexpo'); } }); } }; jquery(window).resize(function() { pageinit.init(); pbanner.init(); }); pageinit.init(); $(document).ready(function() { nav.init(); menu.init(); // pageinit.getsroll(); pbanner.init(); pagenav.init(); pageinit.setermbox(jquery('.ermitem'), "扫描此二维码关注我们"); }); $(window).on('load', function() { var head_height = $(".header").height(); var hash = location.href.split("#")[1]; if (hash) { jquery("html,body").animate({ scrolltop: jquery("#" + hash).offset().top - head_height }, 600); } }); var index_head = $(".yj-bot li.active").index(); var length_ = $(".yj-bot li.active").length; $(".yj-bot li").hover(function() { var yb_index = $(this).index(); $(this).addclass("active").siblings().removeclass('active'); $(".head-wrap").addclass('active'); }).mouseleave(function() { if (length_ > 0) { $(".yj-bot li").removeclass('active').eq(index_head).addclass('active'); } else { $(".yj-bot li").removeclass('active'); } $(".head-wrap").removeclass('active'); }); // 头部菜单 jquery(window).scroll(function() { if (!ismobile) { var head_height = $(".header").height(); if ($(window).scrolltop() >= head_height) { $('.header').addclass('active'); } else { $('.header').removeclass('active'); } } }); // 发展历程 jquery(".ab2banner").slick({ slidestoshow: 1, slidestoscroll: 1, centerpadding: '0', arrows: false, speed: 800, dots: false, infinite: false, centermode: false, autoplay: false, focusonselect: true }); // 社会责任 jquery(".ab7banner").slick({ slidestoshow: 3, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 800, dots: false, infinite: true, centermode: false, autoplay: false, focusonselect: true, responsive: [{ breakpoint: 640, settings: { slidestoshow: 2, slidestoscroll: 1, } }] }); jquery(".cb3banner").slick({ slidestoshow: 1, slidestoscroll: 1, centerpadding: '0', arrows: false, speed: 800, dots: true, infinite: true, centermode: false, autoplay: false, focusonselect: true }); // 锂资源 jquery(".iwb2banner").slick({ slidestoshow: 3, slidestoscroll: 1, centerpadding: '0', arrows: false, speed: 800, dots: true, infinite: true, centermode: false, autoplay: true, focusonselect: true, responsive: [{ breakpoint: 1440, settings: { slidestoshow: 2, slidestoscroll: 1, } }, { breakpoint: 480, settings: { slidestoshow: 1, slidestoscroll: 1, } } ] }); // 人力资源 jquery(".rsbanner").slick({ slidestoshow: 1, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 1000, autoplayspeed: 4000, dots: true, infinite: true, centermode: false, autoplay: true, focusonselect: true, nextarrow: $('.rxnext'), prevarrow: $('.rxprev') }).on({ 'beforechange': function(event, slick, currentslide, nextslide) { jquery(".rxsz").eq(currentslide).removeclass("active").siblings().addclass("active"); jquery(".rxsz").eq(nextslide).addclass("active").siblings().removeclass("active"); } }); jquery(".rxnum .rxsz").on('click', function() { jquery(this).addclass("active").siblings().removeclass("active"); jquery('.rsbanner').slick('slickgoto', jquery(this).index()); }); jquery(".rt1qh").on('mouseover', function() { $(this).addclass('active').siblings().removeclass('active'); });