jquery - Slide Div Back Out when clicking outside of Div -


I have a div that slides by using a toggle I would like the user to toggle the slides in that device And then if he #hiddenpanel click outside of the #hiddenpanel screen.

I currently need to do this using the toggling sliding in and out of the device, when I click outside the user (once it has slipped in it), Div slid Back out ...

Hope this keeps any sense!

Even my JQuery code is:

  var speed = 800; $ ('# Off-bar'). ('Click', function) {var $$ = $ (this), panelWidth = $ ('# hidden panel'). External wide (); $ ('$ Hidden pannell'). $ ('Right: 0}, speed); $$ delete class (' mybutton ')} and {$ (' # hidden pannell '). Chetan ({true: -pennelwedth}, speed) $ add.Class ('myButton')}});  

Here's the markup:

  & lt; Div id = "hiddenpanel" class = "txt-highlight-color bg-color bg-pattern" & gt; & Lt; / Div & gt;  

Here is the URL:

Toggle the bottom 'profile information' text on 'lower right'.

Thank you for your time.

Try the following changes in your code:

  $ ( "Body ($ true), speed);}) speed () () () () () () 800; $ ('# off-bar'). ('Click', function (event) {event.stopPropagation (); Var $$ = $ (this), panelWidth = $ ('# hiddenPanel'). External is Wide (); $ ($.) ('. MyButton')) {$ ('# hidden panel') $ ($ True: 0}, speed); $$ RemoveClass ('myButton')} and {$ ('# hidden panel'). MET ({true: -pennwidth}, speed); $$ AddClass 'MyButton')}});  

What these changes do:

  • One click event on the body to turn off #hiddenPanel

You can click and add 'myButton' / li>

  • to stop and #click-bar for bubbles above the body. Click Body to perform an event to see if the panel is open, and if there is hope for nothing, it helps.


  • Comments