切换有什么问题。其他功能运作良好?

时间:2015-04-11 05:12:15

标签: jquery

我的切换功能不起作用。你能看出出了什么问题吗?

fiddle



$(document).ready(function() {
  $('.dlop1').hide('fast');
  $('.dlop2').hide('fast');

  alert("jquery is working");

  $('#dev1').click(function() {
    $('.dlop1').toggle('slow');
  });

  $('#dev2').click(function() {
    $('.dlop2').toggle('slow');
  });
});

#development1 {
  border: 5px;
  border: 5px solid #086C14;
  border-radius: 9px;
  background: blue
}
#development2 {
  border: 5px;
  border: 5px solid #086C14;
  border-radius: 9px;
  background: blue
}
#dev2 {
  background: orange
}
#dev1 {
  background: orange
}
p {
  background: yellow
}
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<title>
</title>
<body text="black">
<br><br><br><br><br>
<span style="background:green">rt<br></span>
<div id="development1" style="float:left>
<div id="dev1">
<p>tttr</p></div>
<div class="dlop1">
<br>sd
<p style= "background:white">df</p><br>
</div></div><br><br>
<div id="development2" style="float:left>
<div id="dev2">sd
<p>df</p></div>
<div class="dlop2" id="ani2">
<br>sdf
<p style="background:white">sdf</p>
</div>
</div>

<br><br><br><br><br><br><br>
<p align="center" float="down"><b></b><br>
<b>
<A href="starting.html">introduction</a><br>
<A href="intro.html">parts</a><br>
<A href="motion.html">about handling</a><br>
<A href="step1.html">step 1</a></b><br>
<b><A href="step2.html">step 2</a></b><br>
<b><A href="step3.html">step 3</a></b><br>
<b><A href="step4.html">step 4</a></b><br>
<b><A href="step5.html">step 5</a></b><br>
<b><A href="step6.html">step 6</a></b><br>
<b><A href="step7.html">step 7</a></b><br>
<br>
</p>
</body>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

您缺少2个结束引号

 style="float:left> <<<<<<<<<

属性float也不会退出

<p align="center" float="down"><b></b>

最后,您需要为开发div分配宽度

#development1 {
  border:5px;
  border: 5px solid #086C14;
  border-radius:9px;
  background:blue;
  width:100%; /* here */
}

答案 1 :(得分:0)

您分享的代码存在缺陷 请检查此http://jsfiddle.net/3kan98w4/3/

错误1:

 <div id="development1" style="float:left">

错误2:

<div id="development2" style="float:left">

错误3:

<p style="background:white">df</p><br/>

无论您何时尝试使用样式属性,都会因为HTML中断

而导致结束配额丢失