Javascript focus text scroll effect code sharing _ javascript tips-js tutorial

Source: Internet
Author: User
This article mainly introduces the js focus text rolling effect, which is very simple to implement and is recommended to everyone. If you need it, you can refer to it. This article describes the js focus text rolling effect. Share it with you for your reference. The details are as follows:
Effect description:
This is a native js focus chart recommended today.
Automatic Switch by default, or manual switch
Javascript Code adopts function-based object programming, that is, the Module mode in javascript programming.
The basic usage is simple, There are three main features::
1. modular and reusable
2. the variables and functions are encapsulated. They are not in contact with the global namespace and do not pollute global variables.
3. Only public methods are exposed. Other private methods are hidden to ensure that js does not conflict with each other.
Run: ------------------- view results -------------------

TIPS: If the browser cannot run properly, you can try to switch the browsing mode.
The code for the jQuery drop-down beautification search form is as follows:

 Pure js (not dependent on existing frameworks) Focus text scrolling Effect
 

  • 1
  • 2
  • 3
  • 4
  • 5

Script var lanrenzhijia ={}, H $ = function (id) {return document. getElementById (id)}, H $ = function (c, p) {return p. getElementsByTagName (c)} lanrenzhijia. slider = function () {return {init: function (id, options) {var ul = this. u = H $ ('ul ', H $ (id) [0], li = H $ ('lil', ul); this. l = li. length; this. index = 0; if (options. navId & options. curClass) {this. nav = H $ ('lil', H $ (options. navId), this. c = options. curClass ;} This. a = options. auto | 0; this. v = options. vertical | 0; H $ (id ). style. overflow = 'hiden '; H $ (id ). style. position = 'relative '; ul. style. position = 'absolute '; if (this. v) {ul. style. top = 0; this. h = options. height | li [0]. offsetHeight; ul. style. height = (this. l * this. h) + 'px ';} else {ul. style. left = 0; this. w = options. width | li [0]. offsetWidth; ul. style. width = (this. l * this. w) + 'px ';} this. pos (options. index | 0, this. a? 1:0) ;}, pos: function (pos, a) {clearInterval (this. u. posAnim); clearInterval (this. u. auto); var curPos = this. v? ParseInt (this. u. style. top): parseInt (this. u. style. left), correctPos = this. v? Pos * this. h: pos * this. w, direction = correctPos> Math. abs (curPos )? 1:-1; correctPos * =-1; this. index = pos; if (this. nav) {for (var I = 0; I

The above is the js (not dependent on the existing framework) Focus text rolling effect code shared for everyone. I hope you will like it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.