English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery effect hide() method

Método de Efeito do jQuery

hide() method to hide the selected elements.

This method is usually used withshow()methods are used together.

Note:Hidden elements no longer affect the page layout.

Syntax:

$$(selector).hide(duration, easing, callback)

Example

This example hides paragraphs on the page when the page is clicked:

$$("p").click(function(){
  $$(this).hide();
});
Teste e veja‹/›

Hide all <p> elements when the button is clicked:

$$("button").click(function(){
  $$("p").hide();
});
Teste e veja‹/›

UsingdurationParameters:

$$("button").click(function(){
  $$("p").hide(1000);
});
Teste e veja‹/›

UsingcallbackParameters:

$$("button").click(function(){
  $$("div").hide(1000, function(){
    alert("DIV is hidden");
  });
});
Teste e veja‹/›

Animation all spans (in this case, words) are hidden quickly, in200 milliseconds to complete each animation:

$$("button").click(function(){
  $$("span:last-child").hide("fast", function(){
    $$(this).prev().hide("fast", arguments.callee);
  });
});
Teste e veja‹/›

Clique além2Segundos ocultar o elemento span, e então excluir o elemento span ao ocultar:

$("span").click(function(){
  $(this).hide(2000, function(){
    $(this).remove();
  });
});
Teste e veja‹/›

Valor do Parâmetro

ParâmetroDescrição
duration(Opcional)Determina quanto tempo o efeito de ocultamento deve durar. O valor padrão é400 milissegundos

Valores Possíveis:

  • milissegundos (por exemplo100、500、2000 etc)

  • “swing”

  • “slow”

easing(Opcional)Uma string que especifica a velocidade do elemento em diferentes pontos da animação. O valor padrão é “swing”

Valores Possíveis:

  • “swing”-No início/Mover mais devagar no final e mais rápido no meio

  • “linear”-Mover a uma velocidade constante

callback(Opcional)Função chamada após a conclusão do método hide(), chamada uma vez para cada elemento selecionado

Método de Efeito do jQuery