Solved

Find Center Right of screen using JQuery

Posted on 2009-05-04
2
789 Views
Last Modified: 2012-05-06
Hi to all,

I have a Visual Studio 2008 ASP.Net application. This application is written in VB.Net. I use the JQuery Library for most of my JavaScript.

I am using the code below to display a div for pop up. As you can see the div pops up where the mouse is clicked. I want to display the pop up in the middle right of the page. How would I do that?

I am working of a sample below and am still learning JavaScript
$(function() {
            $(document).click(function(e) {
                //getting height and width of the message box
                var height = $('#popuup_div').height();
                var width = $('#popuup_div').width();
                //calculating offset for displaying popup message
                leftVal = e.pageX - (width / 2) + "px";
                topVal = e.pageY - (height / 2) + "px";
                //show the popup message and hide with fading effect
                $('#popuup_div').css({ left: leftVal, top: topVal }).show().fadeOut(1500);
            });
        });

Open in new window

0
Comment
Question by:ALawrence007
[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 12

Accepted Solution

by:
alien109 earned 500 total points
ID: 24296773
0
 

Author Closing Comment

by:ALawrence007
ID: 31577598
Thank you sir. Easy and fast to implement.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SharePoint and CAML query help 4 26
CSS (jquiry mobile) question 3 34
object method as an event handler 8 77
My tooltip is not displaying correct 11 17
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
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 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)
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…

751 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