开发者

hide jquery facebox modal manually

开发者 https://www.devze.com 2023-01-08 21:36 出处:网络
I used my custom close button on my facebox modal to cl开发者_如何学JAVAose it... It works fine (ie) it closes but it appends to the bottom of the page after i click the close button...

I used my custom close button on my facebox modal to cl开发者_如何学JAVAose 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,

hide jquery facebox modal manually

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>


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


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> 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号