Skip to content

Commit

Permalink
Initial version.
Browse files Browse the repository at this point in the history
  • Loading branch information
istvan-ujjmeszaros committed Mar 16, 2014
0 parents commit 96231cb
Show file tree
Hide file tree
Showing 15 changed files with 929 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.idea
.hg
.hgignore
nbproject
node_modules
bower_components
19 changes: 19 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": true,
"noarg": true,
"onevar": false,
"quotmark": "single",
"smarttabs": true,
"trailing": true,
"unused": true,
"node": true,
"globals": {
"$": true,
"jQuery": true
}
}
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 0.10
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contributing

Before sending a pull request remember to follow [jQuery Core Style Guide](http://contribute.jquery.org/style-guide/js/).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Make your changes on the `src` folder, never on the `dist` folder.
4. Commit your changes: `git commit -m 'Add some feature'`
5. Push to the branch: `git push origin my-new-feature`
6. Submit a pull request :D
59 changes: 59 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module.exports = function (grunt) {

grunt.initConfig({

// Import package manifest
pkg: grunt.file.readJSON("bootstrap-autohidingnavbar.jquery.json"),

// Banner definitions
meta: {
banner: "/*\n" +
" * <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n" +
" * <%= pkg.description %>\n" +
" * <%= pkg.homepage %>\n" +
" *\n" +
" * Made by <%= pkg.author.name %>\n" +
" * Under <%= pkg.licenses[0].type %> License\n" +
" */\n"
},

// Concat definitions
concat: {
js: {
src: ["src/jquery.bootstrap-autohidingnavbar.js"],
dest: "dist/jquery.bootstrap-autohidingnavbar.js"
},
options: {
banner: "<%= meta.banner %>"
}
},

// Lint definitions
jshint: {
files: ["src/jquery.bootstrap-autohidingnavbar.js"],
options: {
jshintrc: ".jshintrc"
}
},

// Minify definitions
uglify: {
js: {
src: ["dist/jquery.bootstrap-autohidingnavbar.js"],
dest: "dist/jquery.bootstrap-autohidingnavbar.min.js"
},
options: {
banner: "<%= meta.banner %>"
}
},

});

grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");

grunt.registerTask("default", ["jshint", "concat", "uglify"]);
grunt.registerTask("travis", ["jshint"]);

};
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Bootstrap Auto-Hiding Navbar

An extension for Bootstrap's fixed navbar which hides the navbar while the page is scrolling downwards and shows it the other way. The plugin is able to show/hide the navbar programmatically as well.

- https://github.com/istvan-meszaros/bootstrap-autohidingnavbar
- http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/

Copyright 2014 István Ujj-Mészáros

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
199 changes: 199 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# Bootstrap Auto-Hiding Navbar [![Build Status](https://secure.travis-ci.org/istvan-ujjmeszaros/bootstrap-autohidingnavbar.png?branch=master)](https://travis-ci.org/istvan-ujjmeszaros/bootstrap-autohidingnavbar)
Bootstrap Auto-Hiding Navbar is an extension for Bootstrap's fixed navbar which hides the navbar while the page is scrolling downwards and shows it the other way. The plugin is able to show/hide the navbar programmatically as well.

Check the [official website](http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/) for a demo.

## Usage

1. Download the latest tag from the [releases page](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/releases) or get it via **bower**:

```shell
$ bower install bootstrap-autohidingnavbar
```

2. Include **jQuery** and **Bootstrap**:

```html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/js/bootstrap.min.js"></script>
```

3. Include plugin's code:

```html
<script src="dist/jquery.bootstrap-autohidingnavbar.min.js"></script>
```

4. Call the plugin:

```javascript
$(".navbar-fixed-top").autoHidingNavbar({
// see next for specifications
});
```

## Specifications

### Initialization parameters object

When calling `$(".navbar-fixed-top").autoHidingNavbar()` you can pass a parameters object with zero or more of the following:

- `disableAutohide`, defaults to `false`, set this to `true` if you want to show/hide the navbar programmatically.
- `showOnUpscroll`, defaults to `'true'`, the navbar shows up when scrolling the page upwards (otherwise it shows only when scroll is on page's top).
- `showOnBottom`, defaults to `'true'`, the navbar shows up when scroll reaches the page's end.
- `hideOffset`, defaults to `'auto'`, hides the navbar after scrolling that much pixel. Auto means the navbar's height.
- `animationDuration`, defaults to `'200'`, is the duration of the show and hide animations in milliseconds.

### Methods

You can modify the behavior and aspect of the plugin by calling its methods, most of them accepts a `value`.

To call methods on the auto hiding instance, use the following syntax:

```javascript
$(selector).autoHidingNavbar(methodName, parameter);
```

Here are the available methods:

- `setDisableAutohide(value)` to change the `disableAutohide` parameter.
- `setShowOnUpscroll(value)` to change the `showOnUpscroll` parameter.
- `setShowOnBottom(value)` to change the `showOnBottom` parameter.
- `setHideOffset(value)` to change the `hideOffset` parameter.
- `setAnimationDuration(value)` to change the `animationDuration` parameter.
- `show()` to show the navbar programmatically.
- `hide()` to hide the navbar programmatically.
- `destroy()` destroys the plugin instance.


## Structure

The basic structure of the project is given in the following way:

```
├── demo/
│ └── index.html
├── dist/
│ ├── jquery.bootstrap-autohidingnavbar.js
│ └── jquery.bootstrap-autohidingnavbar.min.js
├── src/
│ └── jquery.bootstrap-autohidingnavbar.js
├── .editorconfig
├── .gitignore
├── .jshintrc
├── .travis.yml
├── bootstrap-autohidingnavbar.jquery.json
├── bower.json
├── Gruntfile.js
└── package.json
```

#### [demo/](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/demo)

Contains a simple HTML file to demonstrate the plugin.

#### [dist/](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/dist)

This is where the generated files are stored once Grunt runs.

#### [src/](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/src)

Contains the source files.

#### [.editorconfig](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/.editorconfig)

This file is for unifying the coding style for different editors and IDEs.

> Check [editorconfig.org](http://editorconfig.org) if you haven't heard about this project yet.
#### [.gitignore](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/.gitignore)

List of files that we don't want Git to track.

> Check this [Git Ignoring Files Guide](https://help.github.com/articles/ignoring-files) for more details.
#### [.jshintrc](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/.jshintrc)

List of rules used by JSHint to detect errors and potential problems in JavaScript.

> Check [jshint.com](http://jshint.com/about/) if you haven't heard about this project yet.
#### [.travis.yml](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/.travis.yml)

Definitions for continous integration using Travis.

> Check [travis-ci.org](http://about.travis-ci.org/) if you haven't heard about this project yet.
#### [bootstrap-autohidingnavbar.jquery.json](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/bootstrap-autohidingnavbar.jquery.json)

Package manifest file used to publish plugins in jQuery Plugin Registry.

> Check this [Package Manifest Guide](http://plugins.jquery.com/docs/package-manifest/) for more details.
#### [Gruntfile.js](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/Gruntfile.js)

Contains all automated tasks using Grunt.

> Check [gruntjs.com](http://gruntjs.com) if you haven't heard about this project yet.
#### [package.json](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/tree/master/package.json)

Specify all dependencies loaded via Node.JS.

> Check [NPM](https://npmjs.org/doc/json.html) for more details.
## Building

To build and test the plugin, you need:

- [**NodeJS**](www.nodejs.org) 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:

```shell
$ npm install
$ bower install
```

To run jshint on the plugin code, call:

```shell
$ grunt jshint
```

To build the output js and css files, with the related minified ones, run:

```shell
$ grunt
```

## Issues and Contributions

You can report any issue you may encounter on the [GitHub Issue Tracker](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/issues).

To contribute, please follow the [contribution guidelines](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/blob/master/CONTRIBUTING.md).

## History

Check [Release](https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/releases) list.

## License

```
Copyright 2014 István Ujj-Mészáros
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
29 changes: 29 additions & 0 deletions bootstrap-autohidingnavbar.jquery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "bootstrap-autohidingnavbar",
"title": "Bootstrap Auto-Hiding Navbar",
"description": "An extension for Bootstrap's fixed navbar which hides the navbar while the page is scrolling downwards and shows it the other way. The plugin is able to show/hide the navbar programmatically as well.",
"keywords": [
"bootstrap",
"ui",
"navigation"
],
"version": "1.0.0",
"author": {
"name": "István Ujj-Mészáros",
"url": "https://github.com/istvan-autohidingnavbar"
},
"licenses": [
{
"type": "Apache License v2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"homepage": "http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/",
"demo": "http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/",
"docs": "http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/",
"download": "https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar/archive/master.zip",
"dependencies": {
"jquery": ">=1.7",
"bootstrap": ">=3.0.0"
}
}
25 changes: 25 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "bootstrap-autohidingnavbar",
"version": "1.0.0",
"homepage": "http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/",
"authors": [
{
"name": "István Ujj-Mészáros",
"url": "https://github.com/istvan-ujjmeszaros"
}
],
"description": "An extension for Bootstrap's fixed navbar which hides the navbar while the page is scrolling downwards and shows it the other way. The plugin is able to show/hide the navbar programmatically as well.",
"main": "src/jquery.bootstrap-autohidingnavbar.js",
"dependencies": {
"jquery": ">=1.9.0",
"bootstrap": ">=3.0.0"
},
"keywords": [
"jquery",
"plugin",
"bootstrap",
"ui",
"navigation"
],
"license": "Apache License v2.0"
}
Loading

0 comments on commit 96231cb

Please sign in to comment.