html jQuery效果 - 幻灯片开始

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html jQuery效果 - 幻灯片开始相关的知识,希望对你有一定的参考价值。

* {
  margin: 0px;
  padding: 0px;
}

body {
  font-family: 'Roboto', sans-serif;
  font-size: 20px;
  color: #555;
}

section {
  width: 5in;
  margin: 24px auto;
  text-align: center;
}

section h1.question {
  color: white;
  background-color: purple;
  padding: 24px;
  font-weight: 500;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

section p.answer {
  border: 1px gray solid;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  padding:36px 0px;
}
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
$(function() {
  console.log("ready");

  //hide the answer
  $('section p.answer').hide();

  //listen for a click on the question
  $('section h1.question').click(function() {

    //slideDown() the answer
    //$('section p.answer').slideDown();

    //update the above code using slideToggle ()
    $('section p.answer').slideToggle();

  });

  /*challenge: fade the text in after the p slides down (hint: start with text at opacity 0, either through the css or the js)*/

  //if you have extra time, try out other effects

  //close jQuery ready function	
});
jQuery effect-slide start
-------------------------


Forked from [glenda drew](http://codepen.io/glendadrew/)'s Pen [target practice complete](http://codepen.io/glendadrew/pen/wMPpKr/).

A [Pen](http://codepen.io/spencermathews/pen/vLjPBm) by [Spencer Mathews](http://codepen.io/spencermathews) on [CodePen](http://codepen.io/).

[License](http://codepen.io/spencermathews/pen/vLjPBm/license).
<section>
  <h1 class="question">q: what is this: hahahahplop?</h1>
  <p class="answer">a: someone laughing their head off!

以上是关于html jQuery效果 - 幻灯片开始的主要内容,如果未能解决你的问题,请参考以下文章

jQuery实现3D幻灯片

ASP.NET Grid 中的 Jquery 幻灯片效果

Jquery Slidetoggle - 似乎无法开始关闭?

基于jQuery幻灯片插件Slippry

jquery时间轴幻灯展示源代码

老牌的响应式 jQuery 幻灯片效果