github

Haroenv / holmes

  • суббота, 11 июня 2016 г. в 03:13:51
https://github.com/Haroenv/holmes

JavaScript
Fast and easy searching inside a page



Holmes.js

Fast and easy searching inside a page.

Build Status npm version

Installation

$ npm install --save holmes.js

After which you can add it in your page with i.e. browserify or loading the module in a different script tag.

You have to make sure that you have a css rule for the class .hidden that hides elements however you want. One option is to have this:

.hidden {
  display: none;
}

but this could be any css you want.

Usage

demo

holmes({
  input: '.search input', // queryselector for the input
  find: '.results article', // queryselector for element to search in
  placeholder: 'no results', // (optional) text to show when no results
  class: {
    visible: 'visible', // (optional) class to add to matched elements
    hidden: 'hidden' // (optional) class to add to non-matched elements
  }
});

full documentation

Showcase

What who image
bullg.it @haroenv screenshot of bullg.it
family.scss @lukyvj screenshot of family.scss

I'd love to find out how people use my project, let me know if you want to be featured!

Questions?

Compatible up to IE9.

Let me know on twitter: @haroenv.

License

Apache 2.0