mercredi 30 septembre 2015

jQuery issues with the 'this' modifier and if/else statement

Ok, so I'm trying to make it so that an image can be modified or moved in the browser by clicking on buttons on the side of the page, but the script in my if/else statement isn't working like I'd like it to. Here's what I have so far in jQuery:

var menu = $('ul li').click(function() {
console.log($(this).index());
});

if ($('menu') = 0) {
$('this').css('width', '80%')
}

else if ($('menu') = 1) {
$('this').css('height', '80%')  
}

else if ($('menu') = 2) {
$('this').css('height', '80%')
}

else if ($('menu') = 3) {
$('this').css('top', '30')
}

else if ($('menu') = 4) {
$('this').css('left', '50')
}
else {

}

Aucun commentaire:

Enregistrer un commentaire