单击外部元素时关闭展开的内容

时间:2016-01-11 06:53:09

标签: html css expand

如何在单击外部元素(展开的内容区域)

时关闭/最小化当前展开的内容

当前代码与演示......:



-(void) TakeScreenShot
{
    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
        UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, [UIScreen mainScreen].scale);
    else
        UIGraphicsBeginImageContext(self.view.bounds.size);

    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    NSData * data = UIImagePNGRepresentation(image);
    [data writeToFile:@"foo.png" atomically:YES];
}




2 个答案:

答案 0 :(得分:1)

只需在您的js中添加此代码即可。 enter image description here

$.ajax({
                type: "POST",
                url: URL,
                data: {id: id},
                success: function (result) {
                    $(".modal-body").html('<ul class="bxslider"></ul>');
                    $(".bxslider").append(result);
                    $('.bxslider').bxSlider();
                },
                complete: function (result) {
                     $(window).trigger('resize');
                }
            });

$(document).on('click',function(){
    $('.collapse').collapse('hide');
})
$(document).on('click',function(){
	$('.collapse').collapse('hide');
})

答案 1 :(得分:1)

使用此

 $(document).on('click',function(){ $('.collapse').collapse('hide'); })