我正在尝试使用switch
语句。我想我已经尝试了一切。由于某种原因它只是不工作。这是我的代码:
$(document).ready(function() {
var $right = $('#right');
var $animWebs = $('#animWebs');
var $simpWebs = $('#simpWebs');
var $contact = $('#contact');
$('#txt').addClass('txt', 6000);
$('#nav').mouseover(function() {
$(this).stop().animate({
left: 0
});
});
$('#nav').mouseleave(function() {
$(this).stop().animate({
left: -200
});
});
setInterval(grow, '1000');
function grow() {
$right.animate({
height: 390,
top: 200,
borderRadius: '3%'
}, 1000);
$right.animate({
width: 440,
right: 200
}, 1000);
$('#txt').animate({
opacity: 1
}, 2000);
}
var qw;
$('#click1').click(function() {
qw = 'asd';
});
$('#click2').click(function() {
qw = 'dsa';
});
$('#click3').click(function() {
qw = 'sda';
});
switch (qw) {
case 'asd':
$('#click1').css({
"color": "#d40d0d",
"font-size": "100%",
"text-shadow": "0px 0px 2px green"
});
$('#right').fadeOut(1000);
$animWebs.animate({
top: 170,
left: 300,
width: 500,
height: 400,
backgroundColor: 'white',
borderRadius: 6
}, 3000);
//$(this).removeClass('click1');
break;
case 'dsa':
$('#click2').css({
"color": "#d40d0d",
"font-size": "100%",
"text-shadow": "0px 0px 2px green"
});
$('#right').fadeOut(1000);
$simpWebs.animate({
top: 170,
left: 300,
width: 500,
height: 400,
backgroundColor: 'white',
borderRadius: 6
}, 3000);
//$(this).removeClass('click1');
break;
case 'sda':
$('#click3').css({
"color": "#d40d0d",
"font-size": "100%",
"text-shadow": "0px 0px 2px green"
});
$('#right').fadeOut(1000);
$contact.animate({
top: 170,
left: 300,
width: 500,
height: 100,
backgroundColor: 'white',
borderRadius: 6
}, 3000);
//$(this).removeClass('click1');
break;
}
});