Download the PHP package istvan-ujjmeszaros/bootstrap-dropdown-hover without Composer
On this page you can find all versions of the php package istvan-ujjmeszaros/bootstrap-dropdown-hover. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download istvan-ujjmeszaros/bootstrap-dropdown-hover
More information about istvan-ujjmeszaros/bootstrap-dropdown-hover
Files in istvan-ujjmeszaros/bootstrap-dropdown-hover
Package bootstrap-dropdown-hover
Short Description Open dropdown menus on mouse hover, the proper way.
License Apache-2.0
Homepage https://www.virtuosoft.eu/code/bootstrap-dropdown-hover/
Informations about the package bootstrap-dropdown-hover
Bootstrap Dropdown Hover
Bootstrap Dropdown Hover is a simple plugin which opens Bootstrap dropdown menus on mouse hover, the proper way.
Demo
Check the official website for a demo.
Why I made it, when there are many solutions already?
I had issues with all the previously existing solutions. The simple CSS ones are not using the .open
class on the parent element, so there will be no feedback on the dropdown toggle element when the dropdown menu is visible.
The js ones are interfering with clicking on .dropdown-toggle
, so the dropdown menu shows up on hover, then it is hiding when clicking on the .dropdown-toggle
element, and moving out the mouse will trigger the dropdown menu to show up again.
Some of the js solutions are braking iOS compatibility, some plugins are not working on modern desktop browsers which are supporting the touch events.
That's why I made this proper plugin, which prevents all these issues by using only the standard Bootstrap javascript API, without any hack.
Usage
-
Download the latest tag from the releases page or get it via bower:
-
Include jQuery and Bootstrap:
-
Include plugin's code:
- Call the plugin:
Initiate on all dropdowns/dropups method 1
Initiate on all dropdowns/dropups method 1
Initiate on navbar menu only
Specifications
Initialization parameters object
When calling bootstrapDropdownHover()
you can pass a parameters object with zero or more of the following:
clickBehavior
,'sticky'
|'default'
|'disable'
|'link'
, defaults tosticky
, which means that if we click on an opened dropdown then it will not hide on mouseleave but on a second click only. Can bedefault
, which means that means that the dropdown toggles on hover and on click too,disable
, which disables dropdown toggling with clicking when mouse is detected (so it will open on hover only) orlink
which is likedisable
, but does not prevent the default browser action (i.e. link clicks).hideTimeout
, integer, defaults to200
, how much time the hovered dropdown hides after mouseleave (in milliseconds).
These settings can also be set via HTML5 data attributes on the element itself, e.g. this will override both default and explicit constructor settings:
Methods
You can modify the behavior of the plugin by calling its methods, all of which accept a value
.
To call methods on any dropdown hover instance, use the following syntax:
Here are the available methods:
setClickBehavior(value)
to change theclickBehavior
parameter.setHideTimeout(value)
to change thehideTimeout
parameter.
Furthermore, you can call:
destroy()
to restore the original behavior.
Structure
The basic structure of the project is given in the following way:
dist/
This is where the generated files are stored once Grunt runs.
src/
Contains the source file.
.editorconfig
This file is for unifying the coding style for different editors and IDEs.
Check editorconfig.org if you haven't heard about this project yet.
.gitignore
List of files that we don't want Git to track.
Check this Git Ignoring Files Guide for more details.
.jshintrc
List of rules used by JSHint to detect errors and potential problems in JavaScript.
Check jshint.com if you haven't heard about this project yet.
.travis.yml
Definitions for continous integration using Travis.
Check travis-ci.org if you haven't heard about this project yet.
bootstrap-dropdown-hover.jquery.json
Package manifest file used to publish plugins in jQuery Plugin Registry.
Check this Package Manifest Guide for more details.
Gruntfile.js
Contains all automated tasks using Grunt.
Check gruntjs.com if you haven't heard about this project yet.
package.json
Specify all dependencies loaded via Node.JS.
Check NPM for more details.
Building
To build and test the plugin, you need:
- NodeJS with npm
- bower (install it with
npm install bower --g
) - grunt-cli (install it with
npm install grunt-cli --g
)
Then, cd
to the project directory and install the required dependencies:
To run jshint on the plugin code, call:
To build the output js and css files, with the related minified ones, run:
Issues and Contributions
You can report any issue you may encounter on the GitHub Issue Tracker.
To contribute, please follow the contribution guidelines.
History
Check Release list.