├── .gitignore ├── Gruntfile.js ├── README.md ├── bower.json ├── build ├── css │ └── angular-cuf-nav.min.css └── js │ └── angular-cuf-nav.min.js ├── code-prettify ├── prettify.css └── prettify.js ├── css └── style.css ├── data └── navConf.json ├── img └── angular-cuf-nav.png ├── index.html ├── index.js ├── package.json ├── partials ├── api.html ├── example1.html ├── example2.html ├── example3.html ├── example4.html ├── example5.html └── usage.html └── src ├── css └── angular-cuf-nav.css ├── js └── angular-cuf-nav.js └── template ├── cufNav.html ├── cufNavChildItem.html └── cufNavItem.html /.gitignore: -------------------------------------------------------------------------------- 1 | bower_components/ 2 | node_modules/ 3 | tmp/ 4 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | // Load grunt tasks automatically 4 | require('load-grunt-tasks')(grunt); 5 | 6 | // Time how long tasks take. Can help when optimizing build times 7 | require('time-grunt')(grunt); 8 | 9 | // Project configuration. 10 | grunt.initConfig({ 11 | pkg: grunt.file.readJSON('package.json'), 12 | banner: '/*! <%= pkg.name %> by hjzheng <%= grunt.template.today("yyyy-mm-dd") %> */\n', 13 | uglify: { 14 | options: { 15 | banner: '<%= banner %>' 16 | }, 17 | build: { 18 | src: 'tmp/<%= pkg.name %>.all.js', 19 | dest: 'build/js/<%= pkg.name %>.min.js' 20 | } 21 | }, 22 | cssmin: { 23 | options: { 24 | banner: '<%= banner %>' 25 | }, 26 | build: { 27 | src: 'src/css/<%= pkg.name %>.css', 28 | dest: 'build/css/<%= pkg.name %>.min.css' 29 | } 30 | }, 31 | html2js: { 32 | options: { 33 | module: 'cuf-nav-template' 34 | }, 35 | main: { 36 | src: ['src/template/*.html'], 37 | dest: 'tmp/templates.js' 38 | } 39 | }, 40 | copy: { 41 | main: { 42 | files:[ 43 | {expand: true, cwd: 'src/js', src: ['*.js'], dest: 'tmp/'} 44 | ] 45 | } 46 | }, 47 | concat: { 48 | main: { 49 | src: ['tmp/templates.js', 'tmp/<%= pkg.name %>.js'], 50 | dest: 'tmp/<%= pkg.name %>.all.js' 51 | } 52 | }, 53 | clean: { 54 | all: ['tmp', 'build/*'], 55 | tmp: ['tmp'] 56 | }, 57 | //use ngmin for uglify angular bug 58 | ngmin: { 59 | main: { 60 | src: 'tmp/<%= pkg.name %>.all.js', 61 | dest: 'tmp/<%= pkg.name %>.all.js' 62 | } 63 | } 64 | }); 65 | 66 | //Load the plugin that provides the task. 67 | //grunt.loadNpmTasks('grunt-contrib-uglify'); 68 | //grunt.loadNpmTasks('grunt-contrib-cssmin'); 69 | 70 | // Default task(s). 71 | grunt.registerTask('default', ['clean:all', 'copy:main', 'html2js:main', 'concat:main', 'ngmin', 'uglify', 'cssmin']); 72 | 73 | }; 74 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # angular-cuf-nav 2 | 基于angular的导航菜单 http://get-set.cn/angular-cuf-nav 3 | 4 | ![ScreenShot](https://github.com/hjzheng/angular-cuf-nav/raw/master/img/angular-cuf-nav.png) 5 | 6 | ### Usage 7 | 8 | - Step1: 引入依赖的文件 9 | ```html 10 | 11 | 12 | 13 | 14 | 15 | 16 | ``` 17 | 18 | - Step2: 配置依赖模块 19 | ```javascript 20 | angular.module('test', ['cuf.nav']); 21 | ``` 22 | 23 | ### API 24 | 25 | | 指令 | 描述 | 26 | | ----- | --------- | 27 | | cufNav | 最上层标签 | 28 | | cufNavItem | cufNav的直接子标签 | 29 | | cufNavChildItem | 最后一层标签,可以自己相互嵌套,达到多级菜单效果 | 30 | 31 | **cufNav** 32 | 33 | |参数 | 值 | 作用 | 34 | | --- | --- | ----| 35 | |triggered-event| click 或者 mouseover 默认click | 决定导航菜单以什么事件触发展开| 36 | 37 | **cufNavItem** 38 | 39 | | 参数 | 值 |作用 | 40 | | ----- | --------- | ----| 41 | | label | 字符串 | 决定菜单显示, 它的值必须唯一| 42 | |href |字符串 |一般结合ngRoute或ui.router去使用| 43 | |triggered-event| click 或者 mouseover 默认会使用cufNav的triggered-event值 |决定导航子菜单以什么事件触发展开| 44 | |has-children |布尔值 | 如果cufNavItem下需要包含cufNavChildItem标签,就必须配置该属性,反之不要配| 45 | |item-click | 函数 | | 46 | 47 | 48 | **cufNavChildItem** 49 | 50 | |参数| 值| 作用| 51 | | ----- | --------- | ----| 52 | |label |字符串 |决定菜单显示, 它的值必须唯一| 53 | | href |字符串 |一般结合ngRoute或ui.router去使用| 54 | |has-children |布尔值 | 如果cufNavChildItem下需要嵌套cufNavChildItem标签,就必须配置该属性,反之不要配| 55 | |item-click | 函数 | | 56 | 57 | ### Example 58 | - [Example1](http://get-set.cn/angular-cuf-nav/#/example1) 59 | - [Example2](http://get-set.cn/angular-cuf-nav/#/example2) 60 | - [Example3](http://get-set.cn/angular-cuf-nav/#/example3) 61 | - [Example4](http://get-set.cn/angular-cuf-nav/#/example4) 62 | - [Example5](http://get-set.cn/angular-cuf-nav/#/example5) 63 | 64 | ### More 65 | - git clone https://github.com/hjzheng/angular-cuf-nav 66 | - cd angular-cuf-nav 67 | - npm install 68 | - bower install 69 | - 启动一个喜欢的web server, 使用喜欢的浏览器访问即可 70 | - 或者直接访问 http://get-set.cn/angular-cuf-nav 71 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-cuf-nav", 3 | "description": "Angular Navigation Menu", 4 | "version": "0.0.0", 5 | "homepage": "https://github.com/hjzheng/angular-cuf-nav", 6 | "license": "MIT", 7 | "private": true, 8 | "dependencies": { 9 | "angular": "~1.3.x", 10 | "jquery": ">=1.10.2", 11 | "bootstrap": "~3.1.1", 12 | "angular-ui-router": "^0.2.13", 13 | "angular-resource": "~1.3.x" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /build/css/angular-cuf-nav.min.css: -------------------------------------------------------------------------------- 1 | .link{cursor:pointer}.dropdown-open{background-color:#EEE!important}.dropdown-menu-show{display:block!important}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px;-moz-border-radius:0 6px 6px;border-radius:0 6px 6px}.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent transparent transparent #ccc;border-style:solid;border-width:5px 0 5px 5px;margin-top:5px;margin-right:-10px}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}@media (max-width:768px){.platform-nav-area{min-height:0!important}.dropdown-menu-show{position:static!important;float:none!important;width:auto!important;margin-top:0!important;background-color:transparent!important;border:0!important;box-shadow:none!important}.dropdown-submenu>a:after{display:inline-block;content:"";float:none;width:0;height:0;border-color:#777 transparent transparent!important;border-style:solid;border-width:5px 5px 0!important;margin-top:5px;margin-left:5px}} -------------------------------------------------------------------------------- /build/js/angular-cuf-nav.min.js: -------------------------------------------------------------------------------- 1 | /*! angular-cuf-nav by hjzheng 2016-02-29 */ 2 | angular.module("cuf-nav-template",["template/cufNav.html","template/cufNavChildItem.html","template/cufNavItem.html"]),angular.module("template/cufNav.html",[]).run(["$templateCache",function(a){a.put("template/cufNav.html",'')}]),angular.module("template/cufNavChildItem.html",[]).run(["$templateCache",function(a){a.put("template/cufNavChildItem.html",'
  • \n {{ label }}\n {{ label }}\n \n
  • ')}]),angular.module("template/cufNavItem.html",[]).run(["$templateCache",function(a){a.put("template/cufNavItem.html",'