2015-09-03 29 views
0

我正在使用http://tympanus.net/codrops/2014/07/30/fullscreen-form-interface/来构建表单 - 我希望在点击事件之后页面向下滚动之前有一个延迟。向表单滚动器添加延迟

我一直在尝试使用setTimeout来实现这一点,但一直在挣扎。

例如,我认为这会工作:

// show next field 
    setTimeout(function() { 
     this.ctrlContinue.addEventListener('click', function() { 
      self._nextField(); 
     }); 
    }, 1000); 

您可以在https://github.com/codrops/FullscreenForm/blob/master/js/fullscreenForm.js

感谢

回答

0

看到完整的代码,这应该工作,你不应该之前设置点击事件后暂停。

this.ctrlContinue.addEventListener('click', function() { 
    setTimeout(function() { 
     self._nextField(); 
    }, 1000); 
}); 
+0

这似乎没有工作 –

+0

可以请你创建jsfiddle。所以我可以帮你 –