重新打开加载的jQuery div对话框只打开一次

时间:2011-12-22 22:54:35

标签: jquery jquery-ui dialog

我似乎无法让这个工作,我的代码在下面 当我将鼠标悬停在.loopprod上时,会出现.mi_quickshop 我点击它,一切正常 如果我将鼠标悬停在同一个.loopprod并再次单击.mi_quickshop,我什么也得不到。

非常欢迎任何帮助

<script>
$(function() {
    $('.mi_popup').each(function() {
        //$(this).dialog({ autoOpen: false });
});

$('.loopprod').hover(
    function() {$(this).find('.mi_quickshop').fadeIn('slow')},
    function() {$(this).find('.mi_quickshop').hide()}
    //$(this).parent().find('.mi_popup').dialog();
);

$('.mi_quickshop').click(function() {

    var $mibox=$(this).parent().find('.mi_popup');
    $mibox.dialog('destroy');  //make sure the dialog will re-open.
    $mibox.dialog({ modal: true, width:600, height:500});
    $mibox.dialog('open');                  

});

//$('.mi_form').ajaxSubmit({success:function() {alert('thanks')} });

// prepare the form when the DOM is ready 
    var options = { 
    success: displaySlideCart  // post-submit callback 
    }; 

    // bind to the form's submit event 
$('.mi_form').submit(function() { 

    // inside event callbacks 'this' is the DOM element so we first 
    // wrap it in a jQuery object and then invoke ajaxSubmit 
    $(this).ajaxSubmit(options); 

    // !!! Important !!! 
    // always return false to prevent standard browser submit and page navigation 
    return false; 
    }); 
});


// pre-submit callback 
function showRequest(formData, jqForm, options) { 

// formData is an array; here we use $.param to convert it to a string to display it 
// but the form plugin does this for you automatically when it submits the data 
var queryString = $.param(formData); 

// jqForm is a jQuery object encapsulating the form element.  To access the 
// DOM element for the form do this: 
// var formElement = jqForm[0]; 

// alert('About to submit: \n\n' + queryString); 

// here we could return false to prevent the form from being submitted; 
// returning anything other than false will allow the form submit to continue 
return true; 
} 

 /*
// post-submit callback 
function showResponse(responseText, statusText, xhr, $form)  { 
// for normal html responses, the first argument to the success callback 
// is the XMLHttpRequest object's responseText property 

// if the ajaxSubmit method was passed an Options Object with the dataType 
// property set to 'xml' then the first argument to the success callback 
// is the XMLHttpRequest object's responseXML property 

// if the ajaxSubmit method was passed an Options Object with the dataType 
// property set to 'json' then the first argument to the success callback 
// is the json data object returned by the server 

alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
'\n\nThe output div should have already been updated with the responseText.'); 
console.log('m1');
displaySlideCart();
} 
*/


</script>

1 个答案:

答案 0 :(得分:0)

它没有显示第二次,因为你隐藏了它:

function() {$(this).find('.mi_quickshop').hide()}