SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Image link jumping to top of page

    Basically I am using a javascript gallery plugin, Galleriffic, to display an image gallery. I am having an issue with it as when the image is clicked it keeps jumping back to the top of the page. The problem with this is that the thumbnails which are underneath the main image on the page aren't visible and the user must then scroll to see them.

    Is there any way that I can change this so that the link on the image doesn't make the page jump back to the top?

    Please note, that I don't have my version online but the website will show you the code that is being used.

    I am unable to post a link to the website or even just enter it in the thread content it seems as this is my first post but it is at: twospy . com / galleriffic

    All help would be extremely appreciated, thanks

    Aidan

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I imagine it's because the links you're using include a hash at the end. You need to cancel the default action (to follow the link). You do this by returning false in your event handler.

  3. #3
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply, however, I am not 100% sure on how to do that. I am a bit of a novice at the javascript side of things... If you could just explain that a little more for me that'd be great. This is the code for one of the images:

    <ul class="thumbs noscript">
    <li>
    <a class="thumb" href="imagesg/img1.jpg" title="Rocking Robin" >
    <img src="imagesg/img1.jpg" alt="Rocking Robin" width="60px" height="60px"/>
    </a>
    <div class="caption">
    <p>Picture of a small robin</p>
    </div> <!-- caption end -->
    </li>
    </ul>

    There is hash in the address bar once that the image is clicked on for example: address..../gallery.php#0

    Sorry if I am not explaining very well...

    If you want any more info don't hesitate to ask, thanks.

    Aidan

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,713
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    You haven't yet posted any javasacript. Perhaps it is another issue that's causing the problem, one that we could help with if you allowed us to experience it.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I will try and get something live. Sorry about that.

  6. #6
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can view the issue that I am having at: aidanloughran. co .uk / Art / gallery.php

    Obviously without the spaces (I am unable to add links just yet due to the fact that I am new here)

    Hope this helps :-) .

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,713
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    I'm having trouble having the official gallerific demo behave properly on my google chrome.

    Try disabling the "enableHistory" setting. That one changes the address bar and is most likely to be causing the issue. If it is confirmed to be the cause, then it will be easier to research how to enable it without the issue that you're facing.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #8
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have changed this to false, however, the problem still occurs. I assume something is either to be changed in the link on the images with some form of onClick command (as a result of some research that I have already done) or in one of the javascript files that it is loading... Not sure though...

    Aidan

  9. #9
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,713
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    It seems that the minimal demo http://www.twospy.com/galleriffic/minimal.html has no trouble, while the advanced demo http://www.twospy.com/galleriffic/advanced.html show similar issues.

    I think that you should go back to basics using the gallerific code from the minimal demo as a base, and then add things back until you get to what you currently have.

    At some stage along the way, you will begin to experience the trouble, and you will then know what is causing it. Knowing the cause then means you can begin to investigate solution.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •