Git Product home page Git Product logo

horizontalnav's Introduction

HorizontalNav

HorizontalNav is a jQuery plugin that spans a horizontal navigation to fit the full width of it's container. If you've ever had to create this effect on a project, you'll know it's pretty annoying to do. But this plugin makes it easy and adds support for IE7.

By Sebastian Nitu

Plugin URI: https://github.com/sebnitu/HorizontalNav
Author URI: http://sebnitu.com/
Online Demo: http://sebnitu.github.com/HorizontalNav/

How do I use it?

  1. Firstly, include a copy of jQuery in your document. You can download your own copy of jQuery at http://jquery.com or link to the Google hosted script:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  1. Download and include HorizontalNav in your document as well:
<script src="jquery.horizontalNav.js"></script>
  1. Call the horizontalNav function in your document ready function:
$(document).ready(function() {
  $('.nav-wrapper').horizontalNav();
});
  1. You can override the default settings by passing in parameters like this:
$(document).ready(function() {
  $('ul').horizontalNav({
    responsive : false
  });
});
  1. That's it! Your navigation never looked so good :)

But wait, can't I just do this effect using display: table?

Yes, you totally can! And if you don't need to support IE7 then that is the best way that I've found to create this effect. And that's exactly what this plugin uses to create the effect for modern browsers. But if you DO need to support IE7, this plugin is a great polyfill for you. Thanks to hitsthings for bringing this issue up :)

I can't figure out how this works. Is this thing broken?

Although, I would love to help when I can, I am usually pretty swamped with work and can not spare much time helping with support questions. Please make sure to check the documentation or Google your question before writing me for help. I do my best to respond to all my emails but it may take me some time to get to all of them.

If you have any feature requests just let me know! If enough people want a feature I'll most likely built it into the next version.

Using HorizontalNav in your project? Let me know! Shoot me a link of where you're using it.

License

HorizontalNav is built and maintained by Sebastian Nitu and is licensed under the MIT License (MIT). Follow me on Twitter, GitHub and Dribbble.

horizontalnav's People

Contributors

hambrook avatar rachelbaker avatar sebnitu avatar timgluz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

horizontalnav's Issues

Doesn't Play Nice With Superfish Dropdown in FireFox

I haven't tested with any other dropdown plugin, but with Superfish in FireFox for Mac, the dropdowns are aligned far left no matter what top menu you hover over, making the menu unusable as you can't hover down to the sub menu.

white-space: nowrap?

Hi there,

is there a way of preventing the "Navigation Item" in your demo to not wrap, but instead when the point of wrapping would occur to hide the menu totally and show a responsive menu button, which then reveals obviously a differently styled responsive menu?

.clearHorizontalNav div gets duplicated easily

Thank you for all of your work on HorizontalNav, it is a great menu script. I often use HorizontalNav in conjunction with another js script like TinyNav and I found that when the window is resized the div .clearHorizontalNav gets created with each resize.
See screenshot here: http://cl.ly/image/363Y2L15411i

This looks to be a result of the append('<div class="clearHorizontalNav">'); not running only if it doesn't already exist.

Media query

This JS is awesome, but doesn't work well on smaller screens for some menu types, for instance under 400px wide.

It would be great if there was a MediaQuery option. Menutron has a good example:
https://github.com/micjamking/Menutron

Issues in ie7/8

This plugin doesn't work for me in my sites in IE 7/8, it returns an error of 'undefined console'

I have to comment out line 59 - 63 (instances of `console )

// if (o.tableDisplay) { // window.console.log('table display is false'); // } else { // window.console.log('table display is true'); // }

Can't you just use display:table?

I might be misunderstanding, but I believe this can be done with pure CSS.

ul.full-width {
display: table;
width: 100%;
}

ul.full-width > li {
display: table-cell;
}

This should work in IE8+, FF/Chrome/Safari. I'd expect it'd work in Opera too.

The JS options could be a good polyfill for older browsers though.

Am I misunderstanding something about this plugin?

multiple rows equal heights

Hello.
Don't lacking the same height of menu items, if the item in a few lines after resizing.
Very like the option to set the height for the list(li) or link(a).
2014-10-20_17 30 21

Thank's for this wonderful plugin!!!

[enhancement] Add missing bower.json.

Hey, maintainer(s) of sebnitu/HorizontalNav!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library sebnitu/HorizontalNav is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "sebnitu/HorizontalNav",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

Breaking drop downs in FF

Navigation items with drop down menus are being displayed inline instead of in a list style format like its supposed to.

For example

FF:

Menu Item
Sub Menu1 Sub Menu2 Sub Menu3

Webkit, IE, Opera:

Menu Item
Sub Menu1
Sub Menu2
Sub Menu3

Tested in FF 9, 12, and 15.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.