Showing
2 changed files
with
10 additions
and
4 deletions
@@ -3,7 +3,8 @@ | @@ -3,7 +3,8 @@ | ||
3 | let $ = require('yoho-jquery'); | 3 | let $ = require('yoho-jquery'); |
4 | 4 | ||
5 | let $news = $('.news'), | 5 | let $news = $('.news'), |
6 | - newsLiL = $news.find('li').length; | 6 | + newsLiL = $news.find('li').length, |
7 | + newsHeight = 0; | ||
7 | 8 | ||
8 | // tip = require('plugin/tip'); | 9 | // tip = require('plugin/tip'); |
9 | 10 | ||
@@ -14,8 +15,7 @@ if ($('.share-buy-page').height() < $(window).height()) { | @@ -14,8 +15,7 @@ if ($('.share-buy-page').height() < $(window).height()) { | ||
14 | } | 15 | } |
15 | 16 | ||
16 | function Marquee() { | 17 | function Marquee() { |
17 | - let diff, | ||
18 | - newsHeight = $news.find('li:first').height() * newsLiL; | 18 | + let diff; |
19 | 19 | ||
20 | $news.scrollTop($news.scrollTop() + 1); | 20 | $news.scrollTop($news.scrollTop() + 1); |
21 | 21 | ||
@@ -30,5 +30,11 @@ if (newsLiL > 1) { | @@ -30,5 +30,11 @@ if (newsLiL > 1) { | ||
30 | 30 | ||
31 | $news.append('<li>' + $news.find('li:first').html() + '</li>'); | 31 | $news.append('<li>' + $news.find('li:first').html() + '</li>'); |
32 | 32 | ||
33 | + for (let i = 0; i < newsLiL; i++) { | ||
34 | + $news.find('li').eq(i).height($news.find('li:first').height()); | ||
35 | + | ||
36 | + newsHeight = newsHeight + $news.find('li').eq(i).height(); | ||
37 | + } | ||
38 | + | ||
33 | setInterval(Marquee, 100); | 39 | setInterval(Marquee, 100); |
34 | } | 40 | } |
-
Please register or login to post a comment