Thursday 22 April 2010

Disable the parent page when thickbox opens using jquery

I faced a problem that when the thickbox opens i can still TAB through the links by pressing tab button despite the model=true and all the stuff i can do through thickbox. After searching long i found that this is the issue all thickbox like libraries are facing that they cant block their parent page while the child div is open. So i did a workaround hope so that it will be useful for someone else too.

$('#content').live('keydown', function(e) {
  var keyCode = e.keyCode;

  if (keyCode == 9) {
    e.preventDefault();

  }
});

$('#footer').live('keydown', function(e) {
  var keyCode = e.keyCode;

  if (keyCode == 9) {
    e.preventDefault();

  }
});

$('#header').live('keydown', function(e) {
  var keyCode = e.keyCode;

  if (keyCode == 9) {
    e.preventDefault();

  }
});

This thing allows tabbing to be done in the child page while not allowing to tab on the parent page. Content, footer, and header are the id's of the divs in which i had my main content. footer and header

No comments: