Javascript错误屏幕

时间:2017-10-12 07:18:30

标签: javascript jquery html css

我是javascript的新手,我有我的注册和登录屏幕设置我希望它在用户点击注册或登录时滑动,但我的index.js给我错误任何方式来修复它,或者我实施错了吗? Login screen

my error

2 个答案:

答案 0 :(得分:0)

<!DOCTYPE html>
<html>

<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script>
    $(document).ready(function() {
      $("button").click(function() {
        $("div").animate({
          left: '250px'
        });
      });
    });
  </script>
</head>

<body>

  <button>Start Animation</button>

  <p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p>

  <div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div>

</body>

</html>

答案 1 :(得分:-1)

如果您使用的是jQuery,那么您可以添加class / ID.slideToggle(),这样就可以了。

尝试使用以下参考网址:w3schools.com/jquery/tryit.asp?filename=tryjquery_animation1

<!DOCTYPE html> 
<html> 
  <head> 
    <script src="ajax.googleapis.com/ajax/libs/jquery/3.2.1/…; 
    <script> 
      $(document).ready(function(){ 
        $("button").click(function(){ 
          $("div").animate({left: '250px'}); 
        }); 
      }); 
    </script> 
  </head> 

  <body> 
    <button>Start Animation</button> 
    <div style="background:#98bf21;height:100px;width:100px;position:‌​absolute;"></div> 
  </body> 
</html>