I wrote some code to toggle the src of an image and also to pause/resume the jQuery cycle2 plugin.
I\'m not sure why it isn\'t working and would appreciate some help
This is another approach:
And for the jQuery
/* jQuery */
$('#magic-toggle').click(function() {
if($('.fun-img').attr('src') === plus) {
$('.fun-img').attr('src', minus);
} else {
$('.fun-img').attr('src', plus)
}
})
Needs some fun animation, probably, but gets the work done.
Here's a snippet:
var plus = 'https://d30y9cdsu7xlg0.cloudfront.net/png/5805-200.png';
var minus = 'https://d30y9cdsu7xlg0.cloudfront.net/png/5802-200.png';
$('#magic-toggle').click(function() {
if ($('.fun-img').attr('src') === plus) {
$('.fun-img').attr('src', minus);
} else {
$('.fun-img').attr('src', plus)
}
})
.fun-img {
width: 80px;
}
