/ / Onclick Zmeniť obrázok, jQuery? - javascript, jquery

Zapnúť zmenu obrázka, jQuery? - javascript, jquery

Ako môžem dosiahnuť zmenu obrázka kliknutím na tlačidlo? A potom ho zmeniť späť do pôvodného stavu (pôvodný obrázok)?

jQuery(".expand-one").click(function(){
jQuery(".content-one").slideToggle("fast");
});

jQuery(".expand-one").toggle(function() {
jQuery(".content-one").slideDown("slow");
jQuery(this).find("img").css({
"-webkit-transform": "rotate(90deg)",
"-moz-transform": "rotate(90deg)",
"filter": "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)"
});
}, function() {
jQuery(".content-one").slideUp("slow");
jQuery(this).find("img").css({
"-webkit-transform": "rotate(0deg)",
"-moz-transform": "rotate(0deg)",
"filter": "progid:DXImageTransform.Microsoft.BasicImage(rotation=0)"
});
});

Prakticky by som chcel zmeniť OBRÁZOK OBRÁZKU pre OBMEDZENIE OBRAZU.

Vďaka, Aaron

odpovede:

4 pre odpoveď č. 1

Zmeňte značku obrázka na

<img class="expand-one" src="/images/WhateverUrl" data-altsrc="AlternateUrl">

a mať javascript ako

jQuery(".expand-one").click(function(){
var src = $(this).attr("src");
$(this).attr("src", $(this).data("altsrc"));
$(this).data("altsrc", src);
});

demonštrácie