views:

227

answers:

2

I used my custom close button on my facebox modal to close it... It works fine (ie) it closes but it appends to the bottom of the page after i click the close button...

<a onclick="$.facebox.close();" href="javascript:void(0);" class="close"> 
  <img alt="Close the popup" src="images/close.png" title="close" 
     class="close_image" /> 
</a>

Here is what i get,

alt text

Here is what i am trying to do,

$(document).bind('close.facebox', function() {
        $(document).unbind('keydown.facebox')
        $('#aspnetForm').append($('#facebox .content').html());
        /// extra line to make sure there's no flashing effect as the facebox closes: the content is still in there too!
        $('#facebox .content').children().css({ 'display': 'block' });
        $('#facebox').fadeOut(function() {
            $('#facebox .content').removeClass().addClass('content')
            hideOverlay()
            $('#facebox .loading').remove()
        })

    })

My page has this,

   $(document).ready(function($) {
        $.facebox.settings.opacity = 0.2;
        $('a[rel*=facebox]').facebox();
     });

  <div id="forgetPassword" style="display:none"> 
    //content
   </div>
A: 

could it be as easy as fixing your selector?:

<a onclick="$('#facebox').close();" href="javascript:void(0);" class="close">  
  <img alt="Close the popup" src="images/close.png" title="close"  
     class="close_image" />  
</a> 
Fosco
@Fosco that didn't work (ie) it doesn't close my popup...
Pandiya Chendur
Can you show the HTML definition of the facebox?
Fosco
@Fosco look at my edit
Pandiya Chendur
why are you appending on close? That's why it's showing up at the bottom...
Fosco
@Fosco if i comment that line my modal shows an empty div next time...
Pandiya Chendur
Then you're doing something else wrong too... I can't get too deep into it right now, but I would suggest you take things back to basics.. It looks like you're doing too much manual manipulation of classes/etc that should be handled by default.
Fosco
+2  A: 

I replaced OnClick to this onclick="javascript:$(document).trigger('close.facebox')" and it worked..

Pandiya Chendur