簡體   English   中英

jQuery 或 onClick Div 淡入淡出

[英]jQuery or onClick Div Fade

如果這是在錯誤的部分,我深表歉意..

有人可能會指出我關於此的腳本或教程:

當我點擊某物時,例如“x”,我會點擊它,然后它會在點擊時消失。

如果你明白我的意思,有人能指出我正確的方向嗎?

謝謝!

請熟悉谷歌。

然后熟悉http://docs.jquery.com/Tutorials:How_jQuery_Works

http://www.jsfiddle.net上嘗試一些代碼

參考

$('someclass/id').click(function() {
$('someclass/id').fadeOut();
});

檢查這個

$('a').toggle(
function() { $('#us').fadeIn(); },
function() { $('#us').fadeOut(); }
);

.fadeToggle()

show( effect, [options], [speed], [callback] ) jQuery UI

參考這個: http : //www.webdesignerwall.com/demo/jquery/

有針對不同 UI 元素的小教程,有很好的解釋。

很容易你可以用谷歌搜索。

jQuery('#divId').click(function(){
  jQuery(this).hide('slow'); //this will give a little animated effect.
 // or
  jQUery(this).fadeOut('slow');
});

http://api.jquery.com/fadeOut/ http://api.jquery.com/hide/

這描述了如何在單擊時淡入和淡出元素

 $(document).ready(function(){ 
  $("#elemntID").click(function() { 
    $("#ID_of_element_need_to_fade_in").fadeIn("slow");
  });

  $("#elemntID").click(function() { 
    $("#ID_of_element_need_to_fade_out").fadeOut("slow"); 
  });
});

$('#id').click(function() {
$('#id').fadeIn();
$('#id').fadeOut(); 

});
[link][1]
<script>
$("button:first").click(function() {
$("p:first").fadeToggle("slow", "linear");
});
$("button:last").click(function () {
$("p:last").fadeToggle("fast", function () {
 $("#log").append("<div>finished</div>");
});
});
</script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM