Forum Moderators: open

Message Too Old, No Replies

jQuery: Close container by clicking on external link

         

nigassma

6:49 am on Sep 15, 2009 (gmt 0)

10+ Year Member


So the html is being called via .load and I can't sem to figure out a way to get just the link to close the window.

(home)
<li><a href="#dialog" name="modal">Case Studies</a></li>

...

<div id="boxes">
<div id="dialog" class="window">
</div>

</div>

(other page)
<div id="sub-content">
Content loaded from the Case Studies page.

<!-- close button is defined as close class -->
<a href="#" class="close">X Close</a>

</div>

This allows you to click on the entire container to close the window:

$('#dialog').click(function () {
$(this).hide();
$('.window').hide();
});

But I'm trying to get X Close to actually close .window:

$('.close').click(function () {
$(this).hide();
$hide('.window');
});

whoisgregg

1:25 pm on Sep 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It seems like these two lines are exhibiting different syntax approaches. Is it possible only one is correct?

$(this).hide();
$hide('.window');

Perhaps this?

$(this).hide();
$('.window').hide();