添加<script>元素</script>时,CSS转换过渡停止工作

时间:2014-08-28 19:44:29

标签: javascript html css translate transitions

<!DOCTYPE html>
<html>
    <head>  
        <meta charset="UTF-8">
        <link rel="stylesheet" type="text/css" href="assign0CSS.css">
        <title> Songs </title>


    </head>
    <body>

        <div id='headerBar'>

        </div>
        <div id="everything" >

            <div id="loginContainer">
                <div id='topPart'>
                        <h2 id="Welcome"> Welcome   <img  id="add" src="add.png" alt="login" > </h2>

                </div> 
                <form action="#" method= "POST" id="login" name="login">
                    <input type="text" id="Username" name="Username" placeholder="Username"> <br />
                    <input type="password" id="Password" name="Password" placeholder="Password"> <br />
                    <input type="submit" id="SubmitForm" value="Sign In">
                </form>
            </div>
        </div>

        <div id="everything2" >

            <div id="notRegistered" >

                <div id="topPart2">

                        <h2 id='Welcome2' >First time? <img  id="heart" src="heart.png" alt="heart" > </h2>
                </div>

                    <form action="#" method= "POST" id="register" name="register" onSubmit="return validateForm()">

                        <input type="text" id="emailAddress" name="emailAddress" placeholder="Email Address" style="margin-top : 2px;" > <br />

                        <input type="text" id="username2" name="username2" placeholder="Username"> <br />

                        <input type="password" id="password2" name="password2" placeholder="Password"> <br />

                        <input type="password" id="password22" name="password22" placeholder="Confirm Password"> <br />

                        <input type="submit" id="signUp" name="signUp" value="Sign up" > <br />

                    </form>


            </div>
        </div>


        <div id="rightSide">

            <h2 id="SOTW" > Songs of the week </h2>

             <img id="pic1" src="allOfMe.jpg" alt="pic1" >   
             <img id="pic2" src="problem.jpg" alt="pic2" > <br /> 
             <img id="pic3" src="maps.jpg" alt="pic3" > 
             <img id="pic4" src="stayWithMe.jpg" alt="pic4" > <br />

        </div> 


    </body>
</html>

所以我将此代码作为我的主页, 在我的CSS中,我有一些像这样的过渡

#everything, #everything2
{

    -webkit-animation: fadein 2s; /* Safari, Chrome and Opera > 12.1 */
       -moz-animation: fadein 2s; /* Firefox < 16 */
        -ms-animation: fadein 2s; /* Internet Explorer */
         -o-animation: fadein 2s; /* Opera < 12.1 */
            animation: fadein 2s;

            -ms-transform: translatey(20px); /* IE 9 */
    -webkit-transform: translatey(20px); /* Chrome, Safari, Opera */
    transform: translatey(20px);

        -webkit-transition: 1s ease-in-out;
    -moz-transition: 1s ease-in-out;
    -o-transition: 1s ease-in-out;


}

在我的主页上添加脚本标记后立即生效 过渡停止工作但是淡入淡出继续工作 我不知道为什么 谢谢!

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。以下溶剂对我有用。变化

<link rel="stylesheet" type="text/css" href="assignOCSS.css" /> 

进入

    <?php 
    $random = rand(0,999999);
    echo '<link rel="stylesheet" href="assignOCSS.css'.$random.'">';
    ?>

哦,如果您服务器上的样式表隐藏在地图中的某个位置,请将其转换为:

    <?php 
    $random = rand(0,999999);
    echo '<link rel="stylesheet" href="www.mydomain.com/myfolder/assign0CSS.css'.$random.'">';
    ?>

我希望这也适合你!