Git Product home page Git Product logo

autocomplete-lite-img's Introduction

autocomplete-lite-img

autocomplete-lite-img is a lightweight JQuery-based autocomplete plugin. It supports images and callback functions.

DEMO

Usage :

  1. Load JQuery library
  2. Load autocomplete-lite-img.js library
  3. Initialize autocomplete on element and pass items, images ( and callback function )
Format :
$('#jquery_object').autocomplete_img_init({
    items: item_data_array,
    images: image_data_array,
    callback: callback_function
});

NOTE : in your callback function, the first and the second arguments are your_input_element and selected_item_index

Example :
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
   <script src="autocomplete-lite-img.js"></script>

   <input type="text" id="autocomplete_input">

   <script>
       // initializing

       $('#autocomplete_input').autocomplete_init({
           items: ["aaa", "bbb", "ccc", "ddd", "eee", "fff"],
           images: ["aaa.jpg", "bbb.jpg", "ccc.jpg", "ddd.jpg", "eee.jpg", "fff.jpg"],
           callback: callback_function // this argument is optional
       });

       function callback_function(elem, index)
       {
           alert("Selected : " + elem.val() + '. Item index : ' + index);
       }
   </script>

CDNs :

https://cdn.rawgit.com/mridah/autocomplete-lite-img/b3ec899c84ea3332eba6c42df7ef76d1db86c07a/src/autocomplete-lite-img.js

Report bugs and suggestions :

If you want to report a bug or want to add a sugestion, just add it in the issues. Or you can mail me at this.

Copyright and license :

The license is available within the repository in the LICENSE file.

autocomplete-lite-img's People

Contributors

mridah avatar

Stargazers

 avatar

autocomplete-lite-img's Issues

Scroll issue

autocomplete list doesn't scroll when using arrow keys

Change image logic

Suppose there are 4 entries with text hello, they all are currently showing the same image ( that of the first occurrence )

This is due to the line img_map[item_data[i].toLowerCase()] = image_data[i]; being used to map image by the item text.

Need to change this image mapping logic

screenshot from 2016-11-04 01-11-24

Regex error

When search string in input contains more then one \, it gives an error autocomplete-lite-img.js:63 Uncaught SyntaxError: Invalid regular expression: /\w*\/: \ at end of pattern

screenshot from 2016-11-04 00-28-17

Make css customizable

  • add some predefined themes

  • add option to pass css or class as parameter on initialization

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.