VOOZH about

URL: https://www.geeksforgeeks.org/jquery/jquery-mobile-popup-beforeposition-event/

⇱ jQuery Mobile Popup beforeposition Event - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

jQuery Mobile Popup beforeposition Event

Last Updated : 23 Jul, 2025

jQuery Mobile is a Web-technology built on top of jQuery. It is used to make responsive content that can be accessed on a variety of devices like tabs, mobiles, and desktops.

In this article, we will be using the jQuery Mobile Popup beforeposition event that is triggered before the popup computes the coordinates where it will appear.

Syntax:

  • Initialize the popup with the beforeposition callback specified:

    $( ".selector" ).popup({
     beforeposition: function( event, ui ) {
     // Your code goes here
     }
    });
  •  
  • Bind an event listener to the popupbeforeposition event:

    $( ".selector" ).on( "popupbeforeposition", function( event, ui ) {} );

Parameters: It accepts a callback function that holds two parameters:

  • event: It accepts Event type value.
  • ui: It accepts Object type value. The ui object can be empty but used for consistency with other events across the library.

CDN Links:

<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>

Example: This example describes the uses of jQuery Mobile Popup beforeposition event.

Output:

👁 jQuery Mobile Popup beforeposition Event

Reference: https://api.jquerymobile.com/popup/#event-beforeposition

Comment
Article Tags:

Explore