Home  >  Article  >  Web Front-end  >  Javascript code to implement horizontal or vertical scrolling of web content_javascript skills

Javascript code to implement horizontal or vertical scrolling of web content_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:49:311376browse

There are two main parts, one is the scrolling content part; the other is the JS scrolling code part, which only has two sentences.

1. Traditional rolling code


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute ]

Traditional scrolling code application effect It is relatively simple, and there are often browser compatibility issues. For example, on FIREFOX, the special effects of marquee will be invalid.

2. Scroll effect implemented by Javascript

//The width and other parameters in the div tag can be adjusted by yourself
[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]

The above is the complete JS scrolling Code, if you want to achieve vertical scrolling, you only need to make simple modifications, that is, use the pixTop attribute of style. Excerpted from Tianyuan Blog
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn