/** * * @authors Your Name (you@example.org) * @date 2017-08-02 17:23:52 * @version $Id$ */ var langInit = function () { var langObj = { cn: '简体', gb: '繁体', en: 'EN' }; var currentLang = TD.util.getQuery('lang'); // 根据当前语言设置导航栏的语言显示 if (currentLang !== '') { $('.nav-lang-current').html('') $('.lang-' + currentLang).hide(); } else { $('.lang-cn').hide(); }; // 事件委托 $('.nav-lang-hidden').on('click', function () { var target = window.event.target || window.event.srcElement; if (target.nodeName.toLowerCase() === 'li') { // 识别选取的语言并转换成xx格式 var nextLang = $(target).attr('class').match(/lang\-(cn|gb|en)/g).toString().replace('lang-', ''); TD.util.setCookie('lang',nextLang,7); if (currentLang !== '') { location.href = location.href.replace('lang=' + currentLang, 'lang=' + nextLang); } else if (TD.util.getQuery('=')) { location.href += '&lang=' + nextLang; } else { location.href += '?lang=' + nextLang; }; }; }); }; var pageInit = function () { langInit(); var checkSize = function () { var clientWidth = document.documentElement.clientWidth || document.body.clientWidth var clientHeight = document.documentElement.clientHeight || document.body.clientHeight; console.log(clientWidth, clientHeight); if (clientWidth / clientHeight < 16/9) { return 0; } else { return 1; } } var bgMode = checkSize(); $('.m-maofm').fullpage({ easingcss3: 'cubic-bezier(.62,.01,0,1)', onLeave: function (index, nextIndex, direction) { console.log(index, nextIndex, direction); var sectionNow = $('.m-maofm' + '>:nth-child(' + index + ')').find('.section-bg'); var sectionNext = $('.m-maofm' + '>:nth-child(' + nextIndex + ')').find('.section-bg'); if (bgMode) { sectionNow.hasClass('ani-bgscale-x') && sectionNow.removeClass('ani-bgscale-x'); sectionNext.hasClass('ani-bgscale-x') || sectionNext.addClass('ani-bgscale-x'); } else { sectionNow.hasClass('ani-bgscale-y') && sectionNow.removeClass('ani-bgscale-y'); sectionNext.hasClass('ani-bgscale-y') || sectionNext.addClass('ani-bgscale-y'); } } // scrollOverflow: true }); TD.imgPreload(function () { $('.m-loading').fadeOut(300); }) } $(document).ready(function () { pageInit(); })