# textsliding **Repository Path**: wl7175/textsliding ## Basic Information - **Project Name**: textsliding - **Description**: 当一行文字超出固定宽度后自动左右滑动的插件 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-05-29 - **Last Updated**: 2021-11-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 当一行文字超出固定宽度后,自动左右滑动的js插件 > 有时候会有这样的需求,比如显示公交站名或者地铁站名时,当站名比较长,自动来回滑动显示对于用户比较友好 ### 使用方法 - 安装 ``` npm install textsbliding -S ``` - 引用 ``` import Textsbliding from 'textsbliding' const textsbliding = new Textsbliding({ parentClass: '.textover-animation-parent', // 容器的元素类名,也可以用ID childClass: '.textover-animation-child', // 文字的元素类名,也可以用ID speed: 5, // 默认规定时间移动5px time: 100, // 默认 100ms移动一次 direction: 'landscape' // 默认横向 横向 landscape 纵向 portrait }) textsbliding.init() ``` - 效果可以下载包里面的example 浏览器查看