尝试创建滚动脚本,而不是滚动整个html主体,我想只在我的网站滚动推特小部件。

时间:2017-02-14 09:11:25

标签: javascript jquery twitter automation widget

 function scroll(element, speed) {
     element.animate({ scrollTop: $(document).height() }, speed, function() {
         $(this).animate({ scrollTop: 0 }, speed, scroll(element, speed));
     });
 }

 scroll($('html, body'), 1000);

^This is the code I"m running, and it scrolls the entire html view, however I want it to scroll only the twitter widget on my site. I tried doing. 

scroll($('html, .twitter-timeline'), 1000);
scroll($('html, iframe'), 1000);

等。不知道如何选择twitter iframe,哪个类或id负责滚动,所以我可以选择它?

1 个答案:

答案 0 :(得分:0)

http://imgur.com/HNjYxRF 这是开发者工具截图。我也尝试更改此选项以选择data-widget-id。