Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Quick question – change link on click

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28822
    emma
    Participant

    Hey all,

    My photo gallery consist of small thumbnails and one main image displayed that swaps when clicking the thumbs.
    Here is my html

    Code:

    I added a zoom, hence the link surrounding the main image.

    My jQuery for swapping the #main_view looks like this

    Code:
    jQuery(“ul.thumb li img”).click(function() {

    var mainImage = jQuery(this).attr(‘src’);
    jQuery(“#main_view”).attr(‘src’,mainImage);
    return false;

    });

    Because I added the zoom effect I will need to change the link href along with the #main_view source. My newbie skills though adding

    Code:
    jQuery(“.zoomThis”).attr(‘href’,mainImage)

    would be enough but apparently I was once again wrong. (sigh)

    Any ideas how to get this working?

    Thank you

    #74701
    emma
    Participant

    Thanks for your reply, but I don’t think I made myself clear.

    Changing the src of the image works fine, but I want to change the href of my (.zoomThis) link too… Any ideas?

    #74929
    emma
    Participant

    Nope, it doesn’t work… :|

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.