html - How to change a link with jQuery -
i'm making own image gallery , have decent version working.
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.
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
Post a Comment