I have made a very basic social slider bar that hides at the side of my site, then slides out on hover. It all works if i give the jQuery set values for the current css 'left' property, however when i try and get the left property and set it as a variable the script stops working. Have i missed something?
$('#slider').mouseenter(function () {
var cssleft = $(this).css('left');
if ($('#slider').css('left') === "cssleft") {
$(this).animate({
left: '0'
}, 300, function () {});
} else {
$(this).animate({
left: ("cssleft" + 'px')
}, 100, function () {});
}
});
$('#slider').mouseleave(function () {
$(this).delay(1000).animate({
left: ("cssleft" + 'px')
}, 500, function () {});
});
There is a working version with set values here
Thanks guys!