Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 17:49:31
Original
1428 people have browsed it

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
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template