Home > Web Front-end > JS Tutorial > jQuery implements Twitter's automatic text completion effects_jquery

jQuery implements Twitter's automatic text completion effects_jquery

WBOY
Release: 2016-05-16 16:29:45
Original
1610 people have browsed it

The above effect can be achieved using the jQuery plug-in Typeahead.js. This jQuery plug-in comes from a new project of Twitter and supports remote and local data sets. The unique feature is that you can use local storage to save the data set locally, which effectively improves the user experience. It also has many options for handling remote data sets, such as (request frequency, maximum number of concurrent requests, etc.).

Main Features

Supports local data saving, client loading, optimized loading speed
Supports multiple languages ​​and supports Arabic
Support Hogan.js template engine integration
Supports assembly of multiple data sets
Supports local and remote data sets

Project Address

http://twitter.github.io/typeahead.js

How to use

First introduce the jQuery framework and the related JS and CSS files of the Typeahead.js plug-in into the head of the web page

Copy code The code is as follows:




Then add the HTML element that you want to animate, such as

Copy code The code is as follows:


FinallyInitialization

Copy code The code is as follows:

view source
$( '#demo' ).typeahead({
name: 'test' ,
local: [ "Site518" , "Lwolf" ],
limit: 10
});
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