本文实例为大家分享了微信小程序实现无缝滚动的具体代码,供大家参考,具体内容如下
wxml
{{index}}{{item.ip}}{{item.str}} {{item.ip}}{{item.str}}
JS
onShow(){ let windowWidth = wx.getSystemInfoSync().windowWidth; //屏幕宽度 wx.createSelectorQuery().select('.firstScroll').boundingClientRect(function (rect) { let txtLength = rect.width;//文字+图标长度 console.log(txtLength) console.log(rect) // that.setData({ // marginLeft: txtLength
wxss:
.wrap-item{ position: relative; z-index: 10; display: flex; white-space: nowrap; } .brand-info .messages-scroll { display: flex; white-space: nowrap; margin-top: 148rpx; } .brand-info .messages-scroll .items { display: flex; white-space: nowrap; box-sizing: border-box; padding: 0 10rpx; margin-left: 10rpx; align-items: center; /* width: 332rpx; */ height: 50rpx; background: rgba(0, 0, 0, 0.2); border-radius: 25rpx; color: #99A4BA; } .yanse{ color: #C4FFFD !important; } .brand-info .messages-scroll .items image { width: 26rpx; height: 22rpx; margin-right: 10rpx; } .brand-info .messages-scroll .items view { font-size: 24rpx; font-family: Source Han Sans CN; font-weight: 400; }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。