I've made a sort of accordion with three expanding divs (#a
, #b
, #c
) in fiddle, but when I save it locally and open it in a browser the transitions are no longer smooth. I noticed specifically after clicking #b
with #a
expanded. I've included the HTML that references the CSS and JavaScript code. What's the cause and what is the best way to solve it?
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="wrapper">
<div class="outer">
<div class="middle">
<div class="inner" id="a">1</div>
<div class="inner" id="b">2</div>
<div class="inner" id="c">3</div>
</div>
</div>
</div>
<script src="accordion.js"></script>
</body>
Here is a link to the fiddle: http://jsfiddle.net/tJugd/3794/
It seems like it only happens when either #a
is expanded and #b
or #c
are clicked or #b
is expanded and #c
is clicked.
Try using single
click
event handler for animations with.animate()
easings
property set to"linear"
,css
transition
for effects, setwidth
of.middle div
elements to33%
jsfiddle http://jsfiddle.net/tJugd/3798/
Try this