Window 滚动上的移动元素

Moving element on Window scroll

您会在这个 JsFiddle 中看到 https://jsfiddle.net/xpvt214o/402281/ 在 window 滚动时有一个图像在另一个图像中滚动。 我如何修改下面的内容,使其在到达该元素(在所有 br 标签之后)之前不会开始滚动? 我试过抵消它但没有取得任何进展。

滚动慢一点就好了

jQuery(document).ready(
function() {

var $w = $(window);
var $d = $('.oh');

$(window).scroll(function(event) {
  var st = $w.scrollTop();

  _x = st;

  lastScrollTop = st;

  $d.css('bottom', _x);      

});

});

这是我要实现的目标的示例https://www.sketchapp.com/

我发现这个符合我的要求

https://codepen.io/JTParrett/pen/BkDie

$.fn.moveIt = function(){
var $window = $(window);
var instances = [];

$(this).each(function(){
instances.push(new moveItItem($(this)));
});

window.addEventListener('scroll', function(){
var scrollTop = $window.scrollTop();
instances.forEach(function(inst){
  inst.update(scrollTop);
});
}, {passive: true});
}

var moveItItem = function(el){
this.el = $(el);
this.speed = parseInt(this.el.attr('data-scroll-speed'));
};

moveItItem.prototype.update = function(scrollTop){
  this.el.css('transform', 'translateY(' + -(scrollTop / this.speed) + 
'px)');
};

// Initialization
$(function(){
  $('[data-scroll-speed]').moveIt();
});