Commit 07fc88b5ae9b1c811720fd264562b8bc8f312f5d
1 parent
c4542a56
车流量section
Showing
1 changed file
with
1 additions
and
3 deletions
src/views/newssection.vue
| ... | ... | @@ -47,14 +47,11 @@ export default { |
| 47 | 47 | }, |
| 48 | 48 | methods: { |
| 49 | 49 | scroll() { |
| 50 | - let con1 = this.$refs.rollul; | |
| 51 | - con1[0].style.marginTop = '30px'; | |
| 52 | 50 | this.animate = !this.animate; |
| 53 | 51 | var that = this; // 在异步函数中会出现this的偏移问题,此处一定要先保存好this的指向 |
| 54 | 52 | setTimeout(function () { |
| 55 | 53 | that.list.push(that.list[0]); |
| 56 | 54 | that.list.shift(); |
| 57 | - con1[0].style.marginTop = '0px'; | |
| 58 | 55 | that.animate = !that.animate; // 这个地方如果不把animate 取反会出现消息回滚的现象,此时把ul 元素的过渡属性取消掉就可以完美实现无缝滚动的效果了 |
| 59 | 56 | }, 0) |
| 60 | 57 | } |
| ... | ... | @@ -70,6 +67,7 @@ export default { |
| 70 | 67 | height: 26px; |
| 71 | 68 | background-image: url($img); |
| 72 | 69 | background-repeat:no-repeat ; |
| 70 | + background-position: center center ; | |
| 73 | 71 | } |
| 74 | 72 | .nwwest-roll { |
| 75 | 73 | width: 100%; | ... | ... |