Javascript 在滚动条上绘制/显示路径

Javascript 在滚动条上绘制/显示路径,javascript,jquery,css,html,Javascript,Jquery,Css,Html,我需要建立一个响应时间轴,在滚动动画。本简介的一部分是在滚动时显示路径-路径是一系列圆形,如中所示- 我需要从左到右展示,图像是一个不透明背景的PNG,因为下面的leayers上还有其他东西在进行-基本上我在一个体面的方法上遇到了困难。是否可以使用纯CSS或CSS/JS组合从左到右显示不透明图像 在纯CSS中可能吗?也许吧,尽管我对此表示怀疑 如果我正确理解了您的问题,那么使用CSS/JS就很容易做到。只需显示图像,然后根据位置窗口的滚动位置调整显示的宽度,例如: $(document).re

我需要建立一个响应时间轴,在滚动动画。本简介的一部分是在滚动时显示路径-路径是一系列圆形,如中所示-


我需要从左到右展示,图像是一个不透明背景的PNG,因为下面的leayers上还有其他东西在进行-基本上我在一个体面的方法上遇到了困难。是否可以使用纯CSS或CSS/JS组合从左到右显示不透明图像

在纯CSS中可能吗?也许吧,尽管我对此表示怀疑

如果我正确理解了您的问题,那么使用CSS/JS就很容易做到。只需显示图像,然后根据位置窗口的滚动位置调整显示的宽度,例如:

$(document).ready(function () {
    var total_height = $(document).height();
    $(window).scroll(function () {
        var new_width = 100 + (Math.round($(window).scrollTop() * 100 / total_height) * 4);
        $('#wrapper').css('width', new_width + 'px');
    });
});

在纯CSS中是否可能?也许吧,尽管我对此表示怀疑

如果我正确理解了您的问题,那么使用CSS/JS就很容易做到。只需显示图像,然后根据位置窗口的滚动位置调整显示的宽度,例如:

$(document).ready(function () {
    var total_height = $(document).height();
    $(window).scroll(function () {
        var new_width = 100 + (Math.round($(window).scrollTop() * 100 / total_height) * 4);
        $('#wrapper').css('width', new_width + 'px');
    });
});

在纯CSS中是否可能?也许吧,尽管我对此表示怀疑

如果我正确理解了您的问题,那么使用CSS/JS就很容易做到。只需显示图像,然后根据位置窗口的滚动位置调整显示的宽度,例如:

$(document).ready(function () {
    var total_height = $(document).height();
    $(window).scroll(function () {
        var new_width = 100 + (Math.round($(window).scrollTop() * 100 / total_height) * 4);
        $('#wrapper').css('width', new_width + 'px');
    });
});

在纯CSS中是否可能?也许吧,尽管我对此表示怀疑

如果我正确理解了您的问题,那么使用CSS/JS就很容易做到。只需显示图像,然后根据位置窗口的滚动位置调整显示的宽度,例如:

$(document).ready(function () {
    var total_height = $(document).height();
    $(window).scroll(function () {
        var new_width = 100 + (Math.round($(window).scrollTop() * 100 / total_height) * 4);
        $('#wrapper').css('width', new_width + 'px');
    });
});

使用此代码

window.onscroll = function (event) {
    var amount = window.pageYOffset + "px";
    document.getElementById("cover").style.left = amount;
}
你可以做到

工作小提琴:

使用此代码

window.onscroll = function (event) {
    var amount = window.pageYOffset + "px";
    document.getElementById("cover").style.left = amount;
}
你可以做到

工作小提琴:

使用此代码

window.onscroll = function (event) {
    var amount = window.pageYOffset + "px";
    document.getElementById("cover").style.left = amount;
}
你可以做到

工作小提琴:

使用此代码

window.onscroll = function (event) {
    var amount = window.pageYOffset + "px";
    document.getElementById("cover").style.left = amount;
}
你可以做到

工作小提琴: