GithubHelp home page GithubHelp logo

acolangelo / jpanelmenu Goto Github PK

View Code? Open in Web Editor NEW
924.0 83.0 188.0 2.61 MB

A jQuery plugin that creates a paneled-style menu (like the type seen in the mobile versions of Facebook and Google, as well as in many native iPhone applications).

Home Page: http://jpanelmenu.com

JavaScript 100.00%

jpanelmenu's Introduction

#jPanelMenu

###Version 1.4.1

jPanelMenu is a jQuery plugin for easily creating and managing off-canvas content.

Check out the demo (and documentation) site to see it in action.

Check out the changelog to see what’s new.

#How Do I Use This Thing?

Start off by including the jPanelMenu.js file in your page. (Bonus points for using the minified version [jPanelMenu.min.js], or for bundling the jPanelMenu code into your own JavaScript file to reduce size and HTTP requests.)

Build your page as you normally would (the source order does not matter), and instantiate jPanelMenu by calling the plugin constructor function.

var jPM = $.jPanelMenu();

By default, jPanelMenu will look for an element with an ID of menu to use as the menu, and elements with a class of menu-trigger to use as the trigger(s). Either use these IDs and classes on your elements, or pass a custom selector string pointing jPanelMenu to your menu and trigger elements in an object into the constructor function call, as follows:

var jPM = $.jPanelMenu({
	menu: '#custom-menu-selector',
	trigger: '.custom-menu-trigger-selector'
});

Note: Check out the options section for more customizable goodness like the above.

After jPanelMenu has been instantiated (make sure to save the returned object to a variable, as shown above), it’s time to turn it on!

jPM.on();

After that, jPanelMenu will be functioning, and that’s it!

If you want to take things to the next level, keep reading.

#How Does This Thing Work?

When jPanelMenu is turned on, two <div> elements are created. The menu element (with an ID of jPanelMenu-menu), and the panel element (with a class of jPanelMenu-panel). In addition, a class of jPanelMenu is applied to the <html> tag.

The menu, #jPanelMenu-menu, contains the elements targeted by the menu selector passed into the jPanelMenu constructor function. By default, the targeted menu element is cloned into #jPanelMenu-menu, and is not removed from its original position in the DOM. This action can be overridden with the clone option.

The panel, .jPanelMenu-panel, contains all of the content in the element specified by the panel option (except for the elements specified by the excludedPanelContent option). The selected content is moved, not cloned, into .jPanelMenu-panel.

To style or select the menu, use the following selector: #jPanelMenu-menu.

To style or select the content panel, use the following selector: .jPanelMenu-panel.

When jPanelMenu is turned off, the two <div> elements are removed, all of the content inside .jPanelMenu-panel is moved back into the <body> element, and the class of jPanelMenu is removed from the <html> tag.

#Does It Animate?

Of course! (If you want it to, there’s an option for that.)

Animation is handled by CSS transitions, for browsers with support. CSS transitions are hardware-accelerated on supporting devices, so the animations are silky smooth.

For browsers that do not support CSS transitions, the jQuery animation engine is used as a fallback.

#Options

The following options are set via an object passed into the constructor function call, as shown below.

var jPM = $.jPanelMenu({
	menu: '#menu',
	trigger: '.menu-trigger',
	duration: 300
});

###menu

A selector string pointing to the desired menu element.

  • Data Type: string
  • Default Value: #menu

###panel

A selector string pointing to the desired root panel element. Point this to the element containing all content that should go into the panel.

  • Data Type: string
  • Default Value: body

###trigger

A selector string pointing to the menu-triggering element.

  • Data Type: string
  • Default Value: .menu-trigger

###excludedPanelContent

A selector string specifying which elements within the <body> element should not be pushed into .jPanelMenu-panel. The selector string may contain any selector, not just tags.

Generally, <style> and <script> tags should not be moved from their original location, but in certain circumstances (mostly advertising), <script> tags may need to move with the page content.

  • Data Type: string
  • Default Value: style, script

###clone

A boolean value specifying whether or not the targeted menu element should be cloned to create #jPanelMenu-menu, or simply moved in the DOM.

  • Data Type: boolean
  • Accepted Values: true or false
  • Default Value: true

###direction

A string specifying which direction the menu should open from.

  • Data Type: string
  • Accepted Values: left or right
  • Default Value: left

###openPosition

The measurement value for the open position of the menu. Can be set as a pixel, percentage, or em value.

  • Data Type: string
  • Examples: 250px, 75%, 20em
  • Default Value: 250px

###animated

A boolean value specifying whether or not the opening and closing of the menu should be animated.

When using the API functions open( ), close(), and trigger(), this setting can be overridden by passing in true as the parameter. More info in the API section.

  • Data Type: boolean
  • Accepted Values: true or false
  • Default Value: true

###closeOnContentClick

A boolean value specifying whether or not the menu should be closed when clicking on the panel content.

  • Data Type: boolean
  • Accepted Values: true or false
  • Default Value: true

###keyboardShortcuts

An option that allows you to control if keyboard shortcuts are enabled, and if they are, which keys do what.

Setting this option to false will disable keyboard shortcuts entirely. To enable keyboard shortcuts, pass in an array of objects. Each enabled key gets its own object in the array and each object should be structured as follows:

{
	code: 27, /* Keycode of enabled key */
	open: true /* Boolean (true or false), specifying whether or not key should open the menu */
	close: false /* Boolean (true or false), specifying whether or not key should close the menu */
}
  • Data Type: array or boolean

  • Accepted Values: array or false

  • Default Value:

    [ { code: 27, /* Escape Key / open: false, close: true },{ code: 37, / Left Arrow Key / open: false, close: true },{ code: 39, / Right Arrow Key / open: true, close: true },{ code: 77, / M Key */ open: true, close: true } ]


###duration

The time, in milliseconds, which it should take to open and close the menu, when animated.

  • Data Type: int
  • Default Value: 150

###openDuration

The time, in milliseconds, which it should take to open the menu, when animated. If set, this overrides the duration option.

  • Data Type: int
  • Default Value: Inherited from duration

###closeDuration

The time, in milliseconds, which it should take to close the menu, when animated. If set, this overrides the duration option.

  • Data Type: int
  • Default Value: Inherited from duration

###easing

The easing function to use when animating the opening and closing of the menu.

  • Data Type: string
  • Accepted Values: linear, ease, ease-in, ease-out, ase-in-out
  • Default Value: ease-in-out

###openEasing

The easing function to use when animating the opening of the menu. If set, this overrides the easing option.

  • Data Type: string
  • Accepted Values: linear, ease, ease-in, ease-out, ase-in-out
  • Default Value: Inherited from easing

###closeEasing

The easing function to use when animating the closing of the menu. If set, this overrides the easing option.

  • Data Type: string
  • Accepted Values: linear, ease, ease-in, ease-out, ase-in-out
  • Default Value: Inherited from easing

###before

Called before the menu is opened or closed, regardless of animation state.

  • Data Type: function
  • Default Value: function(){ }

###beforeOpen

Called before the menu is opened, regardless of animation state.

  • Data Type: function
  • Default Value: function(){ }

###beforeClose

Called before the menu is closed, regardless of animation state.

  • Data Type: function
  • Default Value: function(){ }

###after

Called after the menu is opened or closed, regardless of animation state.

  • Data Type: function
  • Default Value: function(){ }

###afterOpen

Called after the menu is opened, regardless of animation state.

  • Data Type: function
  • Default Value: function(){ }

###afterClose

Called after the menu is closed, regardless of animation state.

  • Data Type: function
  • Default Value: function(){ }

###beforeOn

Called before the plugin is turned on (when on( ) is called).

  • Data Type: function
  • Default Value: function(){ }

###afterOn

Called after the plugin is turned on (when on( ) is called).

  • Data Type: function
  • Default Value: function(){ }

###beforeOff

Called before the plugin is turned off (when off( ) is called).

  • Data Type: function
  • Default Value: function(){ }

###afterOff

Called after the plugin is turned off (when off( ) is called).

  • Data Type: function
  • Default Value: function(){ }

#API

The following are the methods and properties of the object returned by the jPanelMenu constructor function call. In the following example, these would be the methods and properties of jPM.

var jPM = $.jPanelMenu();

jPM.on();

jPM.trigger(true);

###on( )

Initializes a jPanelMenu instance. Sets up the markup, styles, listeners, and interactions, according to the options passed into the constructor function.

  • Returns: null

###off( )

Destroys a jPanelMenu instance. Resets the markup and styles, removes listeners and interactions.

  • Returns: null

###trigger( animated )

Triggers the opening or closing of the menu, depending on the current state (open or closed).

  • Parameters:
    • animated
      • A boolean value that determines whether or not to animate the action. The action will animate if set to true, and will not animate if set to false. If no value is set, the value of the animated option will be used.
      • Data Type: boolean
      • Accepted Values: true or false
  • Returns: null

###open( animated )

Triggers the opening of the menu.

  • Parameters:
    • animated
      • A boolean value that determines whether or not to animate the action. The action will animate if set to true, and will not animate if set to false. If no value is set, the value of the animated option will be used.
      • Data Type: boolean
      • Accepted Values: true or false
  • Returns: null

###close( animated )

Triggers the closing of the menu.

  • Parameters:
    • animated
      • A boolean value that determines whether or not to animate the action. The action will animate if set to true, and will not animate if set to false. If no value is set, the value of the animated option will be used.
      • Data Type: boolean
      • Accepted Values: true or false
  • Returns: null

###isOpen( )

Checks the current state of the menu. Returns true if the menu is currently open, and false if it is closed.

  • Returns: boolean, true or false

###menu

A property equal to the raw selector string of the created menu object.

  • Data Type: string

###getMenu( )

Returns a jQuery Object containing the created menu object.

  • Returns: jQuery Object

###panel

A property equal to the raw selector string of the created panel object.

  • Data Type: string

###getPanel( )

Returns a jQuery Object containing the created panel object.

  • Returns: jQuery Object

###setPosition( position )

Sets the measurement value for the open position of the menu. Can be set as a pixel, percentage, or em value.

  • Parameters:
    • position
      • A measurement value, set as a pixel, percentage, or em value.
      • Data Type: string
      • Examples: 250px, 75%, 20em
  • Returns: null

#Tips, Best Practices, and Other Good Ideas (with Examples)

jPanelMenu was built to be very open-ended and allow a lot of customization for each implementation. A lot of the customization of jPanelMenu implementations will start with the easy hooks provided by the plugin.

When jPanelMenu is turned on, the following elements are created (or classes applied, in the case of the <html> tag):

<html class="jPanelMenu">
	<head>
		...
	</head>
	<body>
		<div id="jPanelMenu-menu" />
		<div class="jPanelMenu-panel" />
	</body>
</html>

Note: Content abbreviated for simplicity.

In addition, there are a few helpful things to know that will improve specific implementations, regardless of use case.

###Stylin’

There are no default graphical styles injected into your page by jPanelMenu, because, as a developer who loves complete control over my pages, there is nothing I dislike more than plugins which do that. Therefore, all graphical styling is up to you, and jPanelMenu makes it very easy.

When jPanelMenu is turned on, two <div> elements are created. The menu element (selector: #jPanelMenu-menu), and the panel element (selector: .jPanelMenu-panel). In addition, a class of jPanelMenu is applied to the <html> tag.

The background color of .jPanelMenu-panel is set by the plugin, and its value is inherited from the <body> element’s background-color.

If the <body> element’s background-color is not set, the <html> element’s background-color is used. If neither is set, the background-color is set to white.

###Progressive Enhancement

Users without JavaScript (whether they have turned it off or are using a device without it) will obviously not get the interactions provided by jPanelMenu. It’s a good idea to take a “progressive enhancement” approach, and build your site to work without JavaScript and jPanelMenu.

A great way to do this is to use the hooks provided to you by jPanelMenu. When jPanelMenu is turned on, the class jPanelMenu is applied to the <html> tag (conversely, when jPanelMenu is turned off, this class is removed).

Build your site as you normally would, without JavaScript and without styles specific to JavaScript interactions or plugins. Restrict all jPanelMenu-specific styles and script actions to elements that are descendents of .jPanelMenu. Styles such as those which hide elements that are unnecessary with jPanelMenu enabled, or scripting actions specific to jPanelMenu functions, should use the .jPanelMenu selector to ensure that their effects only take hold when jPanelMenu is enabled.

That idea was used to create the demo/documentation page.

###jPanelMenu and jRespond — Perfect Together

I'm a huge fan of jRespond, which is “a simple way to globally manage JavaScript on responsive websites.”

jRespond and jPanelMenu are the perfect couple — use jRespond to enable and disable jPanelMenu at the appropriate breakpoints, creating a truly great experience. That’s how I almost always use jPanelMenu, and I suggest you give it a shot, too.

Responsive design is awesome on its own, but add responsive behavior to the mix, and you’ve made something incredible.

Check out the example of how to use jRespond with jPanelMenu, which includes a basic how-to, code snippets, and helpful tips.

#License

jPanelMenu is distributed freely under the MIT License, so you’re free to use this plugin on any and all projects.

#Changelog

###1.4.1

November 11th, 2014

  • Added touchend listeners for better touch support.

###1.4.0

November 11th, 2014

  • Added panel option.
  • Added clone option.
  • Added setPosition(&nbsp;) API method.
  • Removed support for fixed positioning within the panel. CSS transforms and fixed positioning do not get along well, per the spec. If fixed positioning is needed, use the legacy build in the jPanelMenu repository.
  • Updated .jPanelMenu-panel to be positioned statically.
  • Updated background handling so that all properties are transferred to the .jPanelMenu-panel appropriately.
  • Updated key press preventers to include typing within a <select> field.
  • Fixed event propagation up to the document.
  • Fixed an issue causing links under the menu button to be triggered inadvertently.
  • Fixed an issue with loop styles and the Ember.js framework.

###1.3.0

February 4th, 2013

###1.2.0

February 3rd, 2013

###1.1.1

February 3rd, 2013

  • Fixed a conflict between keyboard shortcuts and text inputs. (Thanks to stoeffel.)
  • Renamed JavaScript resources to be more friendly for future development.

###1.1.0

December 7th, 2012

###1.0.0

November 4th, 2012

  • First release of jPanelMenu.

#Who Made This Wonderful Little Plugin?

jPanelMenu was created, and is maintained, by Anthony Colangelo.

You can find him (@acolangelo) on Twitter and Github.

Have a question about how jPanelMenu works that is not answered here? Have feedback for new features, options, or API functions that I should add? Anything else you want to talk about?

Talk to me on Twitter, where I am @acolangelo, and let’s talk!

jpanelmenu's People

Contributors

acolangelo avatar ghachey avatar markjohndoyle avatar opinxit avatar stoeffel 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  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

jpanelmenu's Issues

Displays menu on page reload or mouse up.

I have jPanelMenu set up with the required "menu" & "trigger" variables, but it is creating the extra div with the copy of the menu without clicking the set "trigger". As it is, mouseup on any of the menu links will trigger the copy of the menu for a brief moment to the right of the layout. The trigger is an svg icon that I have at display "none" until the mobile @media request is made. Here is the site:

http://www.rose-hulman.edu/testing/index.html

<form> tag issue

Not sure what the issue is here, I want to put a form tag within a li tag element to display a search input box on top of a menu of buttons using jPanelMenu.

code:

<li>   
     <form action="/search" method="get" id="search2">
       <input id="searchTxt" name="search" type="text" class="inp" style="margin-top:10px;">
        <input id="searchBtn" type="image" src="/images/shared/btnSearch.png" width="69" height="23" style="margin-top:10px;">
      </form>
</li>

The problem is it renders everything correctly accept from the form tag which is strips out.

Load the page with it closed

Hi, I want to load the page with it closed, I tryed some ways, but it always keep automatically opening when page is loaded.. How could I set it to stay closed when the page loads? Thanks.

Where is the SS-list icon?

I sitting here for some days- The Menu is running but where is the ss-list icon? How can i insert it, because everything i did didn't work.

Only this  icon is shown. not the wonderful apple touch icon.

SO there is a big lack of documentation. What can i do?

Menu trigger not staying 'fixed' with transform version

Hi all,

Great library, really good work! I'm having a slight issue though, I am using the transform version because it's much smoother but my menu-trigger is not staying fixed to the top of the page. It stays fixed on the non-transform version of the library but something is overriding it on the transform version! Here is a link to the site I've just started - http://minerva.chemicalcode.com/. I'd like to fix the whole top grey bar including the menu icon if possible - this is what I'm doing with the non-transform version.

Any help would be fab.

Cheers
Kevin

absolutely positioned trigger

When I set the positioning on the trigger element to absolute, it will no longer trigger the menu.

edit: that was not the problem...need more research.

afterClose is called when loading the widget

Is it on purpose that the afterClose event is called when loading the widget? I have hooked up to the event, and it seems weird that the event is called, even though I haven't opened the menu.

Multiple jpanels

Hello, is it possible to create multiple jpanels.

Like imagine a panel on the left and right. That could double our menu capability.

jPanelMenu-panel has unwanted spaces on either side of it

I am using jPanelMenu and jRespond to make a menu on tablet and mobile versions of my site.

When I turn on jPanelMenu (jPM.on();) I get some unwanted behaviour with the background.
The background becomes white and at smaller screen sizes, I get bars on either side of the screen (the bars are the same as the intended background of my body)
The background of my body is set to a gradient and the html background-color is not set at all.

I'm guessing that jPanelMenu is using the background-color of my html (i.e. white, since it's not set) for it
Bars
s colour. However, I'm curious as to why it's narrower than my screen/window size at smaller window sizes - this is my main problem. I don't want these bars on the mobile and table versions of my site.

Thanks for sharing this script, btw. It's fantastic.

Page scroll

Right now I'm testing jpanelmenu and elgg and ran into a problem. When the menu has been shown once I have choppy scrolling on pages - iPhone3, iPad3.

Any idea why or how to fix this?

Edit:

Without animation, "animated: false", there's no problem with scrolling.

How to Contribute Section in the Readme - Dev Process Structure Request

Should there be some sort of root level or test level file outside of docs folder for dev, or a clearer build process? The respond.js example is in a complete production ready state making it nearly impossible to simply change something in the JS and test it out (minned, concatted, CDNed resources).

I'm trying to work out some iPhone bugs, but it's a major pain. In order to use the respond example to test things out, it looks like I would have to go and rewire all the JS dependencies? Then, if I were to do a pull request, you'd have to cherry pick I guess?

Maybe I'm missing something obvious. Let me know if there's a methodology to contributing

Breaks Bootstrap

This plugin is great, but it pretty much makes my other JS useless. It essentially disables:

  • My back to top link
  • Affixed Bootstrap Navigation that should stick to the top upon a certain scroll point
  • My Sticky Footer, since it wraps all of my content.

Maybe i'm doing something wrong in the JS? I've worked out the following to add/remove it from the dom based on resize or reload break points:

// using jPanelMenu to get popout nav on mobile
    var jPM = $.jPanelMenu({
        menu: '#navPrimary',
        trigger: '#test',
        excludedPanelContent: '#toTop'
    });

    // listen for media query on page load, and apply things
    if (matchMedia('only screen and (max-width: 767px)').matches) {
            jPM.on(); // turn JPM on if we're at mobile on page load
        } else {
            jPM.off(); // turn JPM off if we're not at mobile on page load
    };

    // listen for media changes to reapply things.
    var mql = window.matchMedia('only screen and (max-width:767px)');
    mql.addListener(function(mql) {
        if (mql.matches) {
            jPM.on(); // turn JPM on if we're at mobile on page resize
            console.log("Matches now!");
        } else {
            jPM.off(); // turn JPM off if we're not at mobile on page resize
            console.log("Doesn't match now!");
        }
    });

Any thoughts?

Thanks!

Error with Adsense

Hi acolangelo,
I'm getting an error with jPanelMenu and Adsense that when I use opera and android devices then my website redirected to a blank web with Adsense only. This is really a big bug on jPanelMenu. Hope you will fix it asap :)

Thanks!

Two finger scroll on iphone

Unfortunately if the menu height is bigger than the window height on ios you can only scroll using two fingers (nobody knows they have to use two fingers).

Is there any way around this?

Thanks

disfluency in menu animation

Hi, I love jPanelMenu very much. It works with bootstrap, not like jquery mobile with many conflicts.

The only thing I would like to resolve is menu animation. It seems that the animation is driven by jquery but not css. So, it seems a little bit not fluent. Will you plan to switch to css for animation?

Thanks.

menu trigger bugs out on touch

I came across a strange bug where I have the menu positioned: fixed, anyway when you open up the menu on touch devices, and you click the menu again to close, it tries to close the jpanel -menu. However here is where it gets interesting, it tries to open the menu again and stays open.

Here is why:

Since the trigger-menu button is outside the menu area, and clicking the menu area will close the menu too. So if you click the button, it either catches both to close the jpanel menu. So that's why you get the small animation to close, but then opens and stays open because you touched it again.

I commented this line of code out. It's line 346

if ( jP.menuIsOpen() ) jP.closeMenu(jP.options.animated);

----the full commented code--- starts at 430

                   initiateContentClickListeners: function() {
            $(document).on('click',jP.panel,function(e){
                if ( jP.menuIsOpen() ) jP.closeMenu(jP.options.animated);
            });

            $(document).on('touchend',jP.panel,function(e){
                // if ( jP.menuIsOpen() ) jP.closeMenu(jP.options.animated);
            });
        },

Conflict with facebook API

hi,

I have an issue when the page contains some facebook widget like the facebook like box or the comments API.
Did you or someone else have ever met this problem?

thank you

jPanelMenu and jQuery Mobile working together

Hi,

Just thought I'd share some code that might save someone else some frustration trying to get jPanelMenu to play nice with jQuery Mobile.

My situation was that I wanted the touch-friendly forms from jQuery Mobile but had already implemented jPanelMenu for the slide-out menu features. As it happens, both systems like to create container divs on load. jPanelMenu creates a div with class ".jPanelMenu-panel" and jQueryMobile either appends itself to a div with 'data-role="page"' or creates a new one if it's not found.

So I ended up with two dynamically created container divs, and the jPanelMenu became a bit clunky as a result.

Here's how to make them both share the same container:

<script src="jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="jquery.jpanelmenu.js" type="text/javascript"></script>
<script type="text/javascript">
        $.noConflict();
        jQuery(document).ready(function($) {
                       var jPM = $.jPanelMenu(); jPM.on();
               $.mobile.loadPage.defaults.pageContainer = $(".jPanelMenu-panel");
               $.mobile.changePage.defaults.pageContainer = $(".jPanelMenu-panel");
               $(".jPanelMenu-panel").attr('data-role','page');
</script>
<script src="jquery.mobile-1.3.1.min.js"></script>

The key part is the .attr('data-role','page') for the jPanelMenu-panel, which creates a target for the jQueryMobile script to attach itself to.

Hope that helps!

added space for non-existent scrollbar?

Hi,

Thanks for the plugin, I'm really liking it so far. The issue I'm having, though, is that it's adding a white bar between the pullout menu and the rest of the page. In my browsers, it's doing it on your demo site as well. I THINK it might be from a scroll bar area. From inspecting it, I see #jpanelMenu-menu is set to "overflow-y: scroll". I don't have any overflowing content, so I don't need it. I tried to overwrite it, but it's not sticking. Can you help me out here with a solution? I attached an image for clarity.

Thanks,
Scott

Screen Shot 2013-03-27 at 9 46 15 PM

Getting this to work with jQuery Mobile

I'm trying to utilize this great menu with jQuery Mobile, but the structure of using #MenuName conflicts with jQuery Mobile's natural use of # to switch between divs, causing the menu functionality to be overridden, and instead, having the natural jQuery Mobile "fade to page" animation instead.

Any options for this?

jqm Pages

Hello.

Excellent work!
I have just one question: Is it possible to use your plugin with jQueryMobile pages?
I want to change the pages by clicking the menu links but I think that won't work.
Your example is based on sections but they are always visible.

Greetings

Scroll issues iOS 5

I'm having trouble scrolling when a <li> element is "open". This problem only occurs on iOS 5. As you can se below my menu have <li> elements that contains <ul> elements. And I think this is the problem. When I but all <li> elements in one <ul> the problem is gone. I'm using bootstrap, could it be the problem?

<ul id="menu-top-menu" class="nav" style="display:none;"> <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown">Overview Top Item <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">Overview</a></li> <li><a href="#">Overview2</a></li> <li><a href="#">Overview3</a></li> <li><a href="#">Overview4</a></li> <li><a href="#">Overview5</a></li> <li><a href="#">Overview6</a></li> <li><a href="#">Overview7</a></li> </ul> </li>

The see the whole code visit: http://labs.nilssonnils.se/jpanel/

Any suggestions how to solve this?

Background Images not showing

I'm still having an issue with the background-image disappearing. http://loiseau-noir.com/index.html If you remove the color on .jPanelMenu-panel through inspecting the page you can see the image is still there. Was this a coding error on my part? I have the most recent files.

Similar to this post:
#36

Bug: Suppressing HTML5 audio on iOS

I think I've found an odd issue. I'm using HTML5 audio in a site, and when jPanelMenu is on the audio component doesn't show on iOS. I'm including a link to a small test case.

In the HTML you can see that there are two audio elements, but only one is loading. If you wrap the audio element in p, or div, tags, it doesn't load, but when it's completely free from any styling, it shows.

Any ideas?

http://d.pr/f/S7WV

Content wont scroll most of the time on iPhone5 iOS6.

I have a layout similar to the jPanelMenu site.

http://devsit18.w4.ihscnet.net/

At mobile sizes the top bar is fixed and menu slides out. However, the content often gets frozen. I have tried with and without animation.

This can happen upon page load or after. Sometimes if I try to scroll long enough it will start scrolling. Maybe 30 seconds of flicking with my thumb.

Thanks for any help you can provide.

Shortcuts in inputfield

<div id="#menu">
    <ul>
        <li><a href="#">foo</a></li>
            <li><a href="#">bar</a></li>
    </ul>
</div>
<section>
    <a href="#" id="trigger">open</a>
    <input type="text"></input>
</section>

If you have a inputfield in the content (like in the example above), the shortcuts shouldn't be enabled when the inputfield has the focus. For example, if a user tries to enter the letter "m" the menu opens.

doesn't shift absolutely positioned items

i have a fixed top nav bar that i'd like to get pushed aside along with everything else when the jPanelMenu opens, but no luck. i tried changing shiftFixedChildren to "true", no difference. any suggestions?

Bug in menu-trigger functionality on mobile

Hey, I've come across a bug similar to issue #15 - maybe our specific use case can shed some more light:

Use: We are using jPanel for a mobile site, with animation set to true.

The issue: Touching the menu-trigger button would result in a tiny 'wiggle' but the menu would stay open. Touching anywhere else on the jPanelMenu-panel area closed the menu normally. On desktop, there was no issue, and also if animation was set to false there was no issue.

Debugging, we found that because the closeMenu function is called when the jPanelMenu-panel is clicked, menuIsOpen returns false by the time the click event was registered on the menu-trigger button itself. This resulted in the trigger button immediately opening the menu again.

Our solution was edit the closeMenu function so that the open state (n.setMenuState(!1)) is not set to false until after the animation is completed.

Conflict with jQuery Mobile v1.3?

I wanted to use this plugin with jQuery mobile 1.3 but that seems to break jPanel. The menu just does not show up after clicking on the trigger element and I can still see some list items from the menu on the screen. Everything is working fine when I remove jQ mobile.

Anyone else having this issue?

Thanks!

Inline 'position: relative' attribute on .jPanelMenu-panel element interferes with Bootstrap modal

Hi,

It seems like the initial setup of a panel instance interferes with modal z-indexing in Bootstrap.

Bootstrap sets a z-index for the modal, and the semi-opaque div that appears below it at 1050, and 1040 respectively. When jPanel runs, the modal gets included inside of the .jPanelMenu-panel element. However, bootstrap dynamically inserts the semi-opaque 'modal-backdrop' div dynamically at the end of the body. Because of the position relative being applied to the parent of the modal, the modal appears beneath the backdrop.

Specifically if you change the inline style of 'position: relative' applied to the .jPanelMenu-panel to 'position:static', things work as expected.

Got a work around? In an upcoming release could you change the initial setting for position to static?

Does not close after clicking a link.

I think im too stupid to get this FANTASTIC plugin to work correctly.
When i click on a link in the opened jPanelMenu-menu, the page jumps to the #id , but it does not close.
It opens and closes on .trigger and if you click into the jMenuPanel-panel.

Thanks to anybody who can help.

changing direction doesn't change side scrollbar is on

changing direction doesn't change the side the menu scrollbar is on. so if you change the menu to right for example, the scrollbar is still in its default which is to appear on the right side of the menu.

desired behavior it seems to me would be to keep the scrollbar between the menu and main content area, so if menu is set to appear on the right its scrollbar should be on the left.

Adding a class when jPanel is open

Title says it all.

Could you add an extra class to the div.jPanelMenu-panel when the jPanel. It might be handy to do some extra CSS changes.

I know it can be done with the before/after open/close, but still it would be nice if it did this by default.

Not working on iPhone

I can't get it to work on my iphone..

It works well with mouse clicks, but when I open it on my iphone to check it in its real device, it does nothing..

try to access it from a mobile device.. Don't know what I may be doing wrong.

http://jsfiddle.net/LGskZ/

Non-toplevel fixed elements aren't pushed away (as selector is '> *')

Fixed position element won't always be directly nested in the jPanel.panel, which is when the $(jPanel.panel).find('> *') will fail.

Fix for checkFixedChildren() function:

$(jP.panel).find('*').filter(function() {
    return $(this).css("position") === 'fixed';
}).each(function(){
    jP.fixedChildren.push(this);
});

I do hope there is a better solution then find('*') though.

Simple demo

I'm trying to use your nice lib. Right now I haven't managed to integrate it into my page.

While trying to get it working, the only example I can see is the jPanelMenu main page, which is quite complicated.

Could we have a simple, basic, clean example to look at ?

I think that would be a great help.

Thanks.

Inner scrolling doesn't work in Chrome on android 4.2

Strangely it does sort of work in the default browser app. Although the main content usually also scrolls.

Is it maybe possible to block the whole UI except jPanelMenu? This is quite common in many apps. Perhaps add as an option for developers who want to use the plugin solely for mobile purposes.

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.