Skip to content

Commit

Permalink
added AMD/CommonJS compatibility for the plugin and the addons
Browse files Browse the repository at this point in the history
scrolling for long sub menus now uses HW acceleration + requestAnimationFrame() when possible
scrollInterval option deprecated as it's not needed any more
some tweaks to "sm-core-css.css" and the themes to simplify the script usage - e.g. set default z-index 9999 in "sm-core-css.css", set default sub menus width 12em, etc.
new option noMouseOver - allows disabling onmouseover item/sub menus activation (i.e. make it possible to always behave like in touch mode and use just mouse clicks)
new API event "hideAll.smapi" - fired when the whole menu tree is reset (e.g. on document click, onmouseout)
added support for [data-sm-horizontal-sub] attribute to allow creating horizontal sub menus (additional CSS required for styling the sub menus)
fix: bug with calling "refresh" method when adding a new sub menu
Bootstrap add-on: rework the add-on to support dynamically created navbars - $.SmartMenus.Bootstrap.init() method now available
Bootstrap add-on: fix isCollapsible() method to properly work with right floated main menu LI elementsdded AMD/CommonJS compatibility for the plugin and the addons
  • Loading branch information
vadikom committed Jan 27, 2016
1 parent b00959d commit 9a2745c
Show file tree
Hide file tree
Showing 48 changed files with 1,384 additions and 1,277 deletions.
12 changes: 6 additions & 6 deletions Gruntfile.js
Expand Up @@ -11,43 +11,43 @@ module.exports = function(grunt) {
* <%= pkg.title || pkg.name %> jQuery Plugin - v<%= pkg.version %> - <%= grunt.template.today("mmmm d, yyyy") %>\n\
* <%= pkg.homepage %>\n\
*\n\
* Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, Vadikom Web Ltd.\n\
* Copyright <%= pkg.author.name %>, Vadikom Web Ltd.\n\
* <%= pkg.author.url %>\n\
*\n\
* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n\
*/\n\n',

banner_min: '/*! <%= pkg.title || pkg.name %> jQuery Plugin - v<%= pkg.version %> - <%= grunt.template.today("mmmm d, yyyy") %>\n\
* <%= pkg.homepage %>\n\
* Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, Vadikom Web Ltd. <%= pkg.author.url %>; Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',
* Copyright <%= pkg.author.name %>, Vadikom Web Ltd. <%= pkg.author.url %>; Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',

banner_keyboard_addon: '/*!\n\
* <%= pkg.title || pkg.name %> jQuery Plugin Keyboard Addon - v<%= pkg.version_keyboard_addon %> - <%= grunt.template.today("mmmm d, yyyy") %>\n\
* <%= pkg.homepage %>\n\
*\n\
* Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, Vadikom Web Ltd.\n\
* Copyright <%= pkg.author.name %>, Vadikom Web Ltd.\n\
* <%= pkg.author.url %>\n\
*\n\
* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n\
*/\n\n',

banner_keyboard_addon_min: '/*! <%= pkg.title || pkg.name %> jQuery Plugin Keyboard Addon - v<%= pkg.version_keyboard_addon %> - <%= grunt.template.today("mmmm d, yyyy") %>\n\
* <%= pkg.homepage %>\n\
* Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, Vadikom Web Ltd. <%= pkg.author.url %>; Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',
* Copyright <%= pkg.author.name %>, Vadikom Web Ltd. <%= pkg.author.url %>; Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',

banner_bootstrap_addon: '/*!\n\
* <%= pkg.title || pkg.name %> jQuery Plugin Bootstrap Addon - v<%= pkg.version_bootstrap_addon %> - <%= grunt.template.today("mmmm d, yyyy") %>\n\
* <%= pkg.homepage %>\n\
*\n\
* Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, Vadikom Web Ltd.\n\
* Copyright <%= pkg.author.name %>, Vadikom Web Ltd.\n\
* <%= pkg.author.url %>\n\
*\n\
* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n\
*/\n\n',

banner_bootstrap_addon_min: '/*! <%= pkg.title || pkg.name %> jQuery Plugin Bootstrap Addon - v<%= pkg.version_bootstrap_addon %> - <%= grunt.template.today("mmmm d, yyyy") %>\n\
* <%= pkg.homepage %>\n\
* Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, Vadikom Web Ltd. <%= pkg.author.url %>; Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',
* Copyright <%= pkg.author.name %>, Vadikom Web Ltd. <%= pkg.author.url %>; Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',

distdir: '<%= pkg.name %>-<%= pkg.version %>',

Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
@@ -1,4 +1,4 @@
Copyright (c) 2015 Vasil Dinkov, Vadikom Web Ltd.
Copyright (c) Vasil Dinkov, Vadikom Web Ltd.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
53 changes: 53 additions & 0 deletions README.md
Expand Up @@ -7,10 +7,63 @@ Check out [the demo page](http://vadikom.github.io/smartmenus/src/demo/).

- [Download the latest release](http://www.smartmenus.org/download/).
- Install with [Bower](http://bower.io): `bower install smartmenus`.
- Install with [npm](https://www.npmjs.com): `npm install smartmenus`.
- Clone the repo: `git clone https://github.com/vadikom/smartmenus.git`.

Check out the [project documentation](http://www.smartmenus.org/docs/) for quick setup instructions, API reference, tutorials and more.

## Addons usage as modules
If you need to use any of the addons from the "addons" directory as an AMD or CommonJS module:

### AMD
Make sure your SmartMenus jQuery plugin module is named `jquery.smartmenus` since the addons require that name. For example, in RequireJS you may need to add this in your config if you would like to use the minified version:
```javascript
requirejs.config({
"paths": {
'jquery.smartmenus': 'jquery.smartmenus.min'
}
// ...
```
### CommonJS (npm)
The addons are available as separate npm packages so you could properly install/require them in your project in addition to `jquery` and `smartmenus`:
- Bootstrap Addon: `npm install smartmenus-bootstrap`
- Keyboard Addon: `npm install smartmenus-keyboard`
#### Example with npm + Browserify
package.json:
```javascript
{
"name": "myapp-using-smartmenus",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"jquery": ">=2.1.3",
"smartmenus": ">=1.0.0",
"smartmenus-keyboard": ">=0.2.0"
},
"devDependencies": {
"browserify": ">=9.0.3"
}
}
```
entry.js:
```javascript
var jQuery = require('jquery');
require('smartmenus');
require('smartmenus-keyboard');

jQuery(function() {
jQuery('#main-menu').smartmenus();
});
```
Run browserify to create bundle.js: `browserify entry.js > bundle.js`
## Homepage
<http://www.smartmenus.org/>
Expand Down
41 changes: 27 additions & 14 deletions bower.json
@@ -1,14 +1,7 @@
{
"name": "smartmenus",
"version": "1.0.0-beta1",
"title": "SmartMenus",
"description": "Advanced jQuery website menu plugin. Mobile first, responsive and accessible list-based website menus that work on all devices.",
"homepage": "http://www.smartmenus.org/",
"main": [
"dist/jquery.smartmenus.js"
],
"authors": [
"Vasil Dinkov <vasko.dinkov@gmail.com> (http://vadikom.com)"
],
"keywords": [
"menu",
"navigation",
Expand All @@ -17,16 +10,36 @@
"mobile",
"ui"
],
"version": "1.0.0",
"version_keyboard_addon": "0.3.0",
"version_bootstrap_addon": "0.3.0",
"main": [
"dist/jquery.smartmenus.js"
],
"author": {
"name": "Vasil Dinkov",
"email": "vasko.dinkov@gmail.com",
"url": "http://vadikom.com"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"repository": {
"type": "git",
"url": "git://github.com/vadikom/smartmenus.git"
},
"license": "MIT",
"bugs": "https://github.com/vadikom/smartmenus/issues",
"homepage": "http://www.smartmenus.org/",
"docs": "http://www.smartmenus.org/docs/",
"download": "http://www.smartmenus.org/download/",
"dependencies": {
"jquery": ">=1.4.4"
},
"ignore": [
".gitignore",
"Gruntfile.js"
],
"dependencies": {
"jquery": ">=1.4.4"
}
}
]
}

0 comments on commit 9a2745c

Please sign in to comment.