Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 滚动div中的内容时';过去了_Javascript_Css_Scroll_Viewport - Fatal编程技术网

Javascript 滚动div中的内容时';过去了

Javascript 滚动div中的内容时';过去了,javascript,css,scroll,viewport,Javascript,Css,Scroll,Viewport,尝试在此网站上完成以下操作: 显示响应性设计的部分,当访问者滚动超过该点时,设备内的图像开始滚动。我试图复制它,我在页脚中看到了一个.js,这可能是原因之一。现在我的测试页面上有css和html 非常感谢您的帮助。奇爱正在使用他们自己的Kubrick js,可在以下位置获得: 如果您只想让“图像在帧内滚动,同时按效果滚动”,您可以这样做: $(window).scroll(function() { var animStart = 0, // the point where the an

尝试在此网站上完成以下操作:

显示响应性设计的部分,当访问者滚动超过该点时,设备内的图像开始滚动。我试图复制它,我在页脚中看到了一个.js,这可能是原因之一。现在我的测试页面上有css和html


非常感谢您的帮助。

奇爱正在使用他们自己的Kubrick js,可在以下位置获得:

如果您只想让“图像在帧内滚动,同时按效果滚动”,您可以这样做:

$(window).scroll(function() {
    var animStart = 0, // the point where the animation starts
        animEnd = 500, // the point, where the animation ends
        scrollStartPos = 0, // the position your inside scrolling element starts
        scrollEndPos = -300, // the position your inside scrolling element should end
        winPosY = window.pageYOffset, // the scroll distance from top of document
        scrollElement = $('.picture'); // the element to scroll

    if(winPosY > animStart && winPosY < animEnd) {
        // how far through the animation are we?
        var howFar = (winPosY - animStart) / (animEnd - animStart),
            scrollPos = Math.round(scrollStartPos + howFar * (scrollEndPos - scrollStartPos));

        scrollElement.css('top', scrollPos + 'px');

        $('.show-stats').html('How far: ' + howFar + '<br>scroll Position: ' + scrollPos);
    }
});
$(窗口)。滚动(函数(){
var animStart=0,//动画开始的点
animEnd=500,//动画结束的点
scrollStartPos=0,//内部滚动元素开始的位置
scrollEndPos=-300,//内部滚动元素应该结束的位置
winPosY=window.pageYOffset,//距文档顶部的滚动距离
scrollElement=$('.picture');//要滚动的元素
if(winPosY>animStart&&winPosY滚动位置:'+scrollPos);
}
});
这里有一把小提琴:


希望这能有所帮助。

可能会发布一些关于您所做工作或遇到问题的代码,一段代码片段或一个js提琴会大有帮助