pay.page.js 947 Bytes
var $ = require('yoho-jquery'),
    lazyLoad = require('yoho-jquery-lazyload');

var prompt = $('.fraud-prompt');
var fraudTip, scrollVal, onePageH, diff, MyMar;

require('../common');

lazyLoad($('img.lazy'));

function getGender() {
    return window.cookie('_Channel') || 'boys';
}

require('../channel/maybe-like')(getGender());

if ($('#goods-list').length === 0) {
    $('.maybe-like').hide();
}

if ($('.fraud-tip').height() > $('.fraud-prompt').height()) {
    var speed = 40;

    $('.fraud-prompt').append('<div class="fraud-tip">' + $('.fraud-tip').html() + '</div>');

    fraudTip = $('.fraud-tip').eq(1);

    function Marquee() {
        prompt.scrollTop(prompt.scrollTop() + 1);

        scrollVal = prompt.scrollTop();
        onePageH = fraudTip[0].offsetTop;
        diff = onePageH - scrollVal; 

        if (diff <= 0) {
            prompt.scrollTop(Math.abs(diff));
        }
    }

    MyMar = setInterval(Marquee, speed);
}