2

親愛なるみんな、

しばらくの間、次の問題に直面しました。私を助けてください!

これが私のコードです:

HTML

<html>

<head>
  <meta charset="utf-8" />


  <!--css stylesheet-->
  <link href="style.css" rel="stylesheet" />

  <!--jQuery external javascript - CDN-->
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
  <link href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" rel="stylesheet" />

</head>

<body>

  <div class="header"></div>

  <div class="content"><input type="button" id="sendData" value="send your data" align="center"></div>

  <div class="barChart"><input type="button" id="reenterButton" value="Re-enter">     </div>

</body>

</html>

CSS

.content {
  text-align: center;
  background-color: white;
  width: 650px;
  height: 650px;
  display: inline-block;
  position: relative;
}



.barChart {
  text-align: center;
  background-color: white;
  width: 650px;
  height: 650px;
  display: inline-block;
  position: relative;
  display: none;            // Make .barchart hide initially
}

Javascript

<script type="text/javascript">
$(document).ready(function() {

  $("#sendData").button()                   
                .click(function() {        
                  $("div.content").hide("slide", {direction: "left"}, "slow", function() {
                    $("div.barChart").show("slide", {direction: "right"}, "slow");
                  });
                 }); 

  $("#reenterButton").button()
                 .click(function() {
                  $("div.barchart").hide("slide", {direction: "right"}, "slow", function() {   
                    $("div.content").show("slide", {direction: "right"}, "slow");
                  });
                 });
});
</script>

#sendDataボタンは正常に機能しますが、 #reenterButton のクリックは 2 番目のステートメント (セレクター ( "div.barchart" )のあるステートメント)では機能しません。

再入力ボタンにクリック アクションを適用した後、.barchartが非表示になりません。

cssファイルで設定したdivステータスと関係ありますか?または、他の何か?

手伝ってくれてありがとう!

4

1 に答える 1

1

2 番目のクリック バインディングにタイプミスがあり $("div.barchart")ます。$("div.barChart")

フィドル

于 2013-04-09T07:00:04.057 に答える