Solved

jquery popup

Posted on 2012-12-27
2
713 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now