How can I keep a jQuery dialog on the screen? -


I do not want to have a focus on the screen, so I'm setting the top and left coordinates of the box. I'm adjusting it so that it appears next to a link and not initially open for one click.

  $ ("# Error"). Dialog ({bgiframe: true, autoOpen: false, width: 'auto', height: 'auto', hide: 'slide', show: 'clip'}););  

and

  & lt; Div id = "error" title = "error" & gt; & Lt; Div id = "error text" & gt; & Amp; Nbsp; & Lt; / Div & gt; & Lt; / Div & gt;  

From here I want to display an error message on the screen. For example, if I'm at the bottom of the page, then I do not want the user to scroll down to see the dialog. The same thing is if the error message is all the way on the right, I want to display it on the left side of the click element, I have the same problem because I have the automatic width and height, before I show the dialog First, the height / width of the div is not known. Either $ ('# Error'). Height () or $ ('# error') width ().

  $ ("# errorText"). Html (request.responseText + '& lt; p & gt; (Click to Esc or close) & lt; / p & gt;'); Var x = el.position () Left + el.outerWidth (); Var y = el.position () Top - $ (document) .scrollTop (); Var position = el.position (); Var underfdialog = position Height + altitudeology; If (thefodialogs below> document.height) {y - = heightoffiDialog; } Var RightsideOfDialog = Status. Left + widthOfTheDialog; If (rightsideofdialogy> document.width) {x - = (widthOfTheDialog + el.outerWidth ()); } $ ("# Error"). Dialog ('option', 'condition', [x, y]). Dialog ('open');  

How do I get a proper height before opening the actual dialogue, The Dudialology and Width of the Dialog? Or should I use something else?

If your goal is to show a message to the user and keep them scrolling to find it - that I believe that is the case on the basis of your statement - you may want to consider using the user to tell the error message. See the following demo:

I think the functionality of the goose may be something you could work with

The primary advantage here is that the error messages appear in a very consistent position and you do not have to worry about the exact location of the "abusive" element, but at the same time - rest assured The error message given will always be visible to the user.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -