2014-01-30 37 views
0

在此代碼中,當我單擊按鈕時,DIV顯示類似於從左上角翻轉。如何在動畫中顯示jQuery.show()

$("#mybutton").click(function() { 
    $("#mydiv").show("slow"); 
}); 

<input type="submit" value="click" id="mybutton" /> 
<div id="mydiv" style="height:50px; width:50px; background-color:#000; display:none;">test</div> 

如何在以下情況下獲得相同種類的效果?

$(document).ready(function() { 
    window.showim = function(src) { 
    $("#divcont1").html(src); 
    }; 
}); 

我試着像但它沒有工作

$(document).ready(function() { 
    window.showim = function(src) { 
    $("#divcont1").html(src).show('slow'); 
    }; 
}); 

HTML代碼

<span class="spcusr" onclick="showim('<h1>I should be displayed now</h1>');">PARIS</span> 
<div id="divcont1"></div> 
+0

@Anton - 抱歉,從複製它沒有注意到我的源文件。遺憾的是還沒有工作。 – lock

+0

我檢查了.show('slow')是正確的,請檢查控制檯!你在代碼 –

回答

1

是腳本,你期待?原諒我,如果這是錯誤的,

$(document).ready(function() { 
window.showim = function(src) { 
    $("#divcont1").hide().html(src).show('slow'); 
}; 
}); 
+0

這個工作的伴侶有錯誤。萬分感謝。 – lock

0
$("#divcont1").html(src).slideToggle(); 

$("#divcont1").html(src).slideToggle('slow');