为什么不起作用?我希望数字和滚动条上的“ h3”都接收到数据量的x变换
do{
/// set txtPrice
BuyActions.MoveToElement(cDriver.FindElementByCssSelector("#send_order_txtPrice"));
BuyActions.Click();
BuyActions.SendKeys(BuyPrice);
/// set txtCount
BuyActions.MoveToElement(cDriver.FindElementByCssSelector("#send_order_txtCount"));
BuyActions.Click();
BuyActions.SendKeys(BuyCount);
/// click btnBuy
BuyActions.MoveToElement(cDriver.FindElementByCssSelector("#send_order_btnSendOrder"));
BuyActions.Click();
BuyActions.Build().Perform();
} while (stop == 0);
window.addEventListener('scroll', function(e) {
var target = document.querySelectorAll('.speg');
var offset = window.pageYOffset;
var index = 0,
length = target.length;
for (index; index < length; index++) {
var pos = offset * target[index].dataset.xoff;
target[index].style.transform = 'translateX(0px' + pos + ')'
}
})
答案 0 :(得分:0)
您缺少一个元素的日期标签,仍然存在一些问题,请参见我的示例
https://jsfiddle.net/4w58ed3o/2/
JS:
window.addEventListener('scroll', function(e) {
var target = document.querySelectorAll('.speg');
var offset = window.pageYOffset;
var index = 0,
length = target.length;
for (index; index < length; index++) {
var pos = offset * target[index].dataset.xoff || 0;
console.log('translateX(' + pos + 'px)');
target[index].style.transform = 'translateX(' + pos + 'px)'
}
})