2

我知道这听起来像是一个基本问题,但事实是我不是动画专家,而且很难从 x 和 y 计算数学。所以,我想知道如何让“gl_banner” div 在 0.5-1 秒后简单地向上滑动并消失,它下面的内容将被推到原来的位置。我使用什么 css 属性?CSS动画?过渡?我该怎么做?

PS 我对动画做了一些研究,我看到了很多动画,高级动画,但找不到简单的上滑动画。一点帮助表示赞赏!谢谢!

HTML 代码:

<div id="gl_banner" style="display:none; visibility:hidden;">Good Luck! :)</div>
                <form id="quiz" action="grade.php" method="post" style="visibility:hidden;">
                    <!--Question 1-->
                    <h3>1. How many percent of modern camera phones use CMOS?</h3>
                    <div>
                        <input type="radio" name="question-1-answers" id="question-1-answers-A" value="A" />
                        <label for="question-1-answers-A">A) 20%</label>
                        <br/>
                        <input type="radio" name="question-1-answers" id="question-1-answers-B" value="B" />
                        <label for="question-1-answers-B">B) 80%</label>
                        <br/>
                        <input type="radio" name="question-1-answers" id="question-1-answers-C" value="C" />
                        <label for="question-1-answers-C">C) 50%</label>
                        <br/>
                        <input type="radio" name="question-1-answers" id="question-1-answers-D" value="D" />
                        <label for="question-1-answers-D">D) 90%</label>
                    </div>
                    <!--Question 2-->
                    <h3>2. Which type of camera setting(s) is best for greater control and flexibility in terms of focusing on a subject?</h3>
                    <div>
                        <input type="radio" name="question-2-answers" id="question-2-answers-A" value="A" />
                        <label for="question-2-answers-A">A) Manual Focus</label>
                        <br/>
                        <input type="radio" name="question-2-answers" id="question-2-answers-B" value="B" />
                        <label for="question-2-answers-B">B) Auto Focus</label>
                        <br/>
                        <input type="radio" name="question-2-answers" id="question-2-answers-C" value="C" />
                        <label for="question-2-answers-C">C) Both A and B</label>
                        <br/>
                        <input type="radio" name="question-2-answers" id="question-2-answers-D" value="D" />
                        <label for="question-2-answers-D">D) Neither</label>
                    </div>
                    <!--Question 3-->
                    <h3>3. What are the three properties included in an exposure triangle?</h3>
                    <div>
                        <input type="radio" name="question-3-answers" id="question-3-answers-A" value="A" />
                        <label for="question-3-answers-A">A) White Balance, ISO, Low Light</label>
                        <br/>
                        <input type="radio" name="question-3-answers" id="question-3-answers-B" value="B" />
                        <label for="question-3-answers-B">B) Shutter Speed, Exposure, ISO</label>
                        <br/>
                        <input type="radio" name="question-3-answers" id="question-3-answers-C" value="C" />
                        <label for="question-3-answers-C">C) Aperture, ISO, Exposure</label>
                        <br/>
                        <input type="radio" name="question-3-answers" id="question-3-answers-D" value="D" />
                        <label for="question-3-answers-D">D) ISO, Aperture, Shutter Speed</label>
                    </div>
                    <!--Question 4-->
                    <h3>4. The higher the ISO, the more noise it produces in an image.</h3>
                    <div>
                        <input type="radio" name="question-4-answers" id="question-4-answers-A" value="A" />
                        <label for="question-4-answers-A">A) True</label>
                        <br/>
                        <input type="radio" name="question-4-answers" id="question-4-answers-B" value="B" />
                        <label for="question-4-answers-B">B) False</label>
                    </div>
                    <!--Question 5-->
                    <h3>5. What is the name of the smartphone you've seen all over this site?</h3>
                    <div>
                        <input type="radio" name="question-5-answers" id="question-5-answers-A" value="A" />
                        <label for="question-5-answers-A">A) Nokia Pureview 808</label>
                        <br/>
                        <input type="radio" name="question-5-answers" id="question-5-answers-B" value="B" />
                        <label for="question-5-answers-B">B) Nokia Lumia 1020</label>
                        <br/>
                        <input type="radio" name="question-5-answers" id="question-5-answers-C" value="C" />
                        <label for="question-5-answers-C">C) Nokia Lumia 925</label>
                        <br/>
                        <input type="radio" name="question-5-answers" id="question-5-answers-D" value="D" />
                        <label for="question-5-answers-D">D) Nokia Lumia 920</label>
                    </div>
                    <br />
                    <hr style="border-top:1px; border-style:solid; border-color: #000;" />
                    <input style="cursor:pointer;" type="submit" value="Submit Quiz" />
                </form>

JavaScript 代码:

function takeQuiz()
{
// hide the intro
document.getElementById('intro').style.display = 'none';

// display the quiz
document.getElementById('quiz').style.visibility = 'visible';
document.getElementById('gl_banner').style.display = 'block';
document.getElementById('gl_banner').style.visibility = 'visible';
} 
4

2 回答 2

0

click检查我使用JQuery 的函数制作的示例:

膝盖小提琴


玩得开心 (:

于 2013-12-30T22:00:20.533 回答
0

使用 jQuery 库。前任:

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>

$( "intro" ).hide(); //hide div "intro" immd 
$( "intro" ).click(function( event ) {//hide div "intro" on click 
  event.preventDefault();
  $( this ).hide();
});

$( "intro" ).show(); //to show after hide

$( "intro" ).fadeOut();
$( "intro" ).fadeIn();
于 2013-11-15T06:36:13.417 回答