2013-03-20 72 views
0

提交时,由于某种原因它不会关闭该facebox。你们能帮我吗?facebox在提交时未关闭

我的代码是:

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 
<script type="text/javascript"> 

$(function() { 

$('#reset_form').click(function() { 
    $('#name,#comment').val(''); 
}); 
$('#submit').click(function() { 

var name = $('#name').val(); 
var comment = $('#comment').val(); 

$.ajax({ 
    url: '../forms/comment_ajax.php?id=<?php echo $_GET['id']; ?>', 
    data: { form_name: name, form_comment: comment }, 
    success: function(data) { 
     $('#new_comment').append(data); 

     $(document).trigger('close.facebox'); 

     $('#new_comment').effect("bounce", { direction:'down', times:5 }, 300);   
     $('html,body').animate({scrollTop:0}, 2000, "easeOutQuart"); 
     return false; 
    } 
}); 
});      
}); 
</script> 



Name: <br /> 
<input type="text" id="name" class="userpass" maxlength="15"/><br /><br /> 

Comment: <br /> 
<textarea id="comment" rows="6" cols="75"></textarea><br /><br /> 

<input type="submit" id="submit" value="Comment" class="button" /> 
<input type="reset" id="reset_form" name="submit" value="Reset" class="button" /> 

这不是做$(document).trigger('close.facebox');

我有一个facebox打开。它的指数是:http://pastebin.com/JhpDhevr

有点凌乱,但是。它没有关闭提交。

+0

[Rü获得在控制台的任何错误..? – sasi 2013-03-20 04:52:09

回答

0

尝试

$('#button-id').click($.facebox.close); 

,而不是

$(document).trigger('close.facebox'); 
+0

恩,没有工作兄弟! – TrippedStackers 2013-03-21 00:25:47