0
我想在滑塊上獲得很好的滑動效果(從左到右)。但它不適用於轉換和jQuery。滑動效果沒有工作
我的代碼有什麼問題嗎?
$(document).ready(function() {
$('.weiter').click(function() {
if ($('.eins').hasClass('active')) {
$('.eins').removeClass('active');
$('.zwei').addClass('active');
} else if ($('.zwei').hasClass('active')) {
$('.zwei').removeClass('active');
$('.eins').addClass('active');
}
});
});
header {
height: 250px;
width: 100%;
display: inline-block;
margin-bottom: 20px;
}
header section.eins {
background: url("http://www.petakids.com/wp-content/uploads/2015/07/sheep-and-lambs-in-field.jpg");
}
header section.zwei {
background: url("https://aos.iacpublishinglabs.com/question/aq/700px-394px/long-sheep-pregnant_1b7dbe4ddad4dd1.jpg?domain=cx.aos.ask.com");
}
header section {
height: 0;
visibility: hidden;
width: 0;
float: left;
}
header section.active {
float: left;
height: 100%;
width: 100%;
visibility: visible;
}
.weiter {
display: block;
cursor: pointer;
height: 50px;
background: red;
width: 50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<header>
<i class="weiter"></i>
<section class="eins active">
<span>
\t <div>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</div>
\t </span>
</section>
<section class="zwei">
<span>
\t <div>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</div>
\t </span>
</section>
</header>
'有什麼錯誤的,我code' - 沒有錯誤,但沒有提出任何應 「滑動」 在都在javascript或css –
你提到的'transition' css在哪裏? – Nope