html - How to change a link with jQuery -


i'm making own image gallery , have decent version working.

fiddle

i'm trying change link main image when thumbnail image clicked not sure how or if can done. can assign link thumbnail can't use gallery need find way change link main image.

currently using following change image , hoping can changing link within same function

$('#thumb1').click(function() {    $('#imgdisplay').anystretch("images/url.jpg", {speed: 1000});    $fancy magik needs happen here i'm guessing;  }); 

tried adding

$("a[href='google link']").attr('href', 'other link'); 

to function broke it, still working on it

seems trying give link main image.

myfiddle

but clarify you, not need give link element redirect page. can js tricks using window.location.href like...

$('#imgdisplay').click(function() {    window.location.href = 'your path here'; }); 

and owwwwww... make code more readable , clean.. element same functionality, use class instead of id event listeners.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -