views:

439

answers:

3

How to make Accessible popup using jquery with custom size and poition in perfect center on screen on any resolution? if JavaScript would be disabled then link should be open like normal link in new window/tab. I need unobtrusive method to add class to link also in script not in xhtml.

+1  A: 

One way to do this is to write a web page for the popup and link to it normally, then add your your js function of the onclick event load the page in using ajax to a dialog box, and return false from the js function.

That way the popup appears as a dialog box when js is turned on as the false return from the function disables the link action but the link behaves normally when js is off.

Sheff
+1  A: 

Something along these lines (as you didn't specify what happens if javascript is enabled fill out yourself the missing pieces)

<a id="accessibleA" href="http://www.google.com" target="_blank">Open Google</a>

$("#accessibleA").click(function() {
  //whatever to open the javascript popup
  return false;
});
jitter
can i add custom size to popup and set poition in perfect center on screen on any resolution
metal-gear-solid
Last time I encountered a popup that was centred on my "screen" it was positioned half on one monitor and half on another. And I thought normal popups were horrible bits of bad usability.
David Dorward
@Jitendra. Depends on how you create your popups. You didn't tell us anything about e.g. which jQuery popup plugin you use or similar
jitter
+1  A: 

hi

You should use lightbox or something. http://leandrovieira.com/projects/jquery/lightbox/

JUGO