Solved

jquery popup

Posted on 2012-12-27
2
733 Views
Last Modified: 2012-12-27
I have followed the example at:
http://jquerymobile.com/demos/1.2.0-alpha.1/docs/pages/popup/popup-panels.html

I have managed to implement the popup and it works well, but I am new to jquery and cannot work out how to catch the click event in the buttons. I have placed the code for the  popupbeforeposition: function in script tags and this works I have tried placing data-click events in the buttons mark up  and adding custom code in the script tags but this never fireshow do I capture the events?

mark up:

<a href="#popupPanel" data-rel="popup" data-transition="slide" data-position-to="window" data-role="button">Open panel</a>
                  
<div data-role="popup" id="popupPanel" data-corners="false" data-theme="none" data-shadow="false" data-tolerance="0,0">

    <button data-theme="a" data-icon="back" data-mini="true">Back</button>
    <button data-theme="a" data-icon="grid" data-mini="true">Menu</button>
    <button data-theme="a" data-icon="search" data-mini="true">Search</button>
      
</div>

<script>
 $( "#popupPanel" ).on({
    popupbeforeposition: function() {
        var h = $( window ).height();

        $( "#popupPanel" ).css( "height", h );
    }
});
</script>
0
Comment
Question by:JoeBo747
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 500 total points
ID: 38723307
First, assign IDs to buttons:

<button id="buttonBack" data-theme="a" data-icon="back" data-mini="true">Back</button>
<button id="buttonMenu" data-theme="a" data-icon="grid" data-mini="true">Menu</button>
<button id="buttonSearch" data-theme="a" data-icon="search" data-mini="true">Search</button>

And then you can do the following:
$('#buttonBack').click(function() {
    //your code here
});

Hope that helps.
0
 
LVL 1

Author Closing Comment

by:JoeBo747
ID: 38723423
Hi Roland,
Thanks for the help, should have spotted the missing ID!
Regards
Joe
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question