Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

jQuery UI: make diaglog close when the user clicks on the page

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone know /can point me in the direction of how I can make a jquery ui diaglog close when the user clicks the page or on another button that opens another dialog?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe something like:



There is probably better ways to do it.

Eric
 
Mark Wa
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That doesnt seem to work. The #dialog is the id of the div used to create the diaglog box, right?
 
Mark Wa
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
......And the reason it didnt work is because it's not "hide" it's "close". Maybe a difference in versions?

I changed that and it now works. Thanks.

I'm going to try to make it close when another opens by myself. If I have any probs, I'll be back!
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
whoops, yeah it should be close. My brain is still not working this morning.

hide is the option to set the animation.

Eric
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A very basic idea would be:



Eric
 
Mark Wa
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I kind of understand what your trying to do there. Your trying to call the function dialogOpened when #diaglog is opened. I dont quite understand what the function is doing.

if null? == true
null?.dialog.close
null? = this?

openElem is not being set anywhere?
how can a boolean also be an element or vice versa?
what is this?
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

openElem is not being set anywhere?


It is being set when it is opened. Your 3rd question answers this one.

how can a boolean also be an element or vice versa?


I am guessing you do not understand how JavaScript works.

null, undefined, false, 0 are considered to be Boolean false values
Anything else [string, objects, functions, etc] are considered to be true

I could have just done if(xxx!==null) and would be the same thing

what is this?


I think this should be the element it is acting on. You can find out by using Firebug and do console.log(this);

[I did not test this code, I just wrote it out thinking how it should work]
 
Mark Wa
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all your help. I have it working now.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic