Jquery URL Change on click -
how can change url of picture on clicking button.
the puspose differentiate url. 1y1.png = (group1)y(group2).png each time when click on 1 of 3 buttons of group1, gives me predetermined letter @ url instead of (group1).
for intance; have pictures under images folder.
1y1.png
1y2.png
1y3.png
2y1.png
2y2.png
2y3.png
3y1.png
3y2.png
3y3.png
and have 6 buttons 2 groups. first groups chages first numbers @ url. , second group changing third letter @ url.
first groups determines background color , second group determines image inside. intance 1y1.png picture white background , there girl inside. second ones (1y2.png) has boys instead of girl. third 1 (1y3.png) white background , has baby inside. , if chose second option first group can going have url changed 2y1.png picture has girl inside blue bacground.
how possible jquery. there simple sample.
i think coding should that
function pictureselect(model) { var gruop1 = $.cookie('background'); if(gruop1==undefined){ colori = 1; } var detayselect = $.cookie('detay'); if((detayselect!=undefined)&&(detayselect!=0)){ $("#yaka").attr("src", "resim/"+gruop1+"y"+gruop2+".png"); }else{ $("#yaka").attr("src", "resim/"+gruop1+"y"+gruop1+".png"); } $("#yaka").css({"display":""}); $.cookie('images',model); }
so, mean :
$('.image_group_1').click(function(){ $("#image_id_1").attr("src", $(this).attr('src')); }); $('.image_group_2').click(function(){ $("#image_id_2").attr("src", $(this).attr('src')); }); $('.image_group_3').click(function(){ $("#image_id_3").attr("src", $(this).attr('src')); }); <img src='1y1.png' class='image_group_1' /> <img src='1y2.png' class='image_group_1' /> <img src='1y3.png' class='image_group_1' /> <img src='2y1.png' class='image_group_2' /> <img src='2y2.png' class='image_group_2' /> <img src='3y3.png' class='image_group_2' /> <img src='3y1.png' class='image_group_3' /> <img src='3y2.png' class='image_group_3' /> <img src='3y3.png' class='image_group_3' /> <img src='' id='image_id_1' /> <img src='' id='image_id_2' /> <img src='' id='image_id_3' />
Comments
Post a Comment