小编Ang*_*elo的帖子

我的脚本需要页面刷新才能运行

每次我第一次加载页面时我的脚本都没有加载,我需要刷新页面至少3次才能运行.如何在没有页面刷新的情况下运行脚本?这个特殊的脚本在BABEL中.

'use strict';

var deg = 0;
var index = 0;

$('#' + index).css('opacity', '1');
$('.navbar').contextmenu(function () {
    return false;
});
$('.navbar').on('mousewheel', function (e) {
    var move = -60;
    var nextIndex = nextIndex = (index + 1) % 6;
    if (e.originalEvent.wheelDelta / 120 <= 0) {
        // wheel up
        move = 60;
        nextIndex = index  -1 < 0 ? 5 : index - 1;
    }
    $('.scroll-list').css('transform', 'rotateX(' + (deg + move) + 'deg)');
    $('#' + index).css('opacity', '0.01');
    $('#' + nextIndex).css('opacity', …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

1
推荐指数
1
解决办法
97
查看次数

标签 统计

javascript ×1

jquery ×1