area-common.js 791 Bytes
const $ = require('jquery');
const lazyload = require('../plugins/lazyload');

let indexObj = {
    init: function () {
        this.lazyLoad();
        this.resizeInit();
        this.resize();
    },
    lazyLoad: function () {
        lazyload($('img.lazy'), {
            threshold: 1000,
            q: 80
        });
    },
    resizeInit: function () {
        let winW = $(window).width();
        let $page = $('body').find('div:first');

        if (winW > 1150) {
            $page.addClass('widthPc');
        } else {
            $page.removeClass('widthPc');
        }
    },
    resize: function () {
        let _this = this;

        $(window).resize(function () {
            _this.resizeInit();
        });
    }
};

$(
    function () {
        indexObj.init();
    }
);