Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Gallery Problem

gallery

  • Please log in to reply
5 replies to this topic

#1 JackomoLight

JackomoLight

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 97 posts
  • Programming Language:PHP, Python, JavaScript, PL/SQL
  • Learning:C, Java, C++, Perl, Ruby, Lisp, Bash

Posted 29 July 2012 - 06:51 AM

Hi Guys, I recently build the following website: http://djdub-it.co.uk

and I am having problem with the gallery on the home page: whenever you click on the gallery to go to the next/previous photo the whole page slides to the top. I assume the problem lies somewhere in the JavaScript code however I couldn't resolve it so far. So any help is appreciated.

Thanks
  • 0

#2 RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1310 posts
  • Location:C:\Countries\US
  • Programming Language:C, Java, C++, PHP, Python, JavaScript

Posted 29 July 2012 - 01:30 PM

What do you use for the 'href' attribute of the 'next picture' and 'previous picture' links?

I suppose you're using '#' ; '#' is the address of the top of the page, so if you don't want the scroll to jump then I don't recommend using '#' .

Rather, instead of this:
<a href="#" ...
, try this:
<a style="cursor: pointer; text-decoration: underline; color: #0000FF;" ...
, and I assume you're already using the 'onclick' attribute to make the links do things.
  • 1
Regards,
RR

#3 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 01 August 2012 - 01:33 AM

I believe the href attribute is required for valid html.

# will indeed scroll to top.
javascript:void(); will not.
  • 0

#4 fread

fread

    Programming God

  • Senior Member
  • PipPipPipPipPipPip
  • 897 posts
  • Location:Trinidad and Tobago
  • Learning:C, Java, C++, C#, PHP, Python, PL/SQL

Posted 01 August 2012 - 07:12 AM

Hi Guys, I recently build the following website: http://djdub-it.co.uk

and I am having problem with the gallery on the home page: whenever you click on the gallery to go to the next/previous photo the whole page slides to the top. I assume the problem lies somewhere in the JavaScript code however I couldn't resolve it so far. So any help is appreciated.

Thanks

It may be easier if you show us the segment of code causing the problem.
  • 0

#5 RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1310 posts
  • Location:C:\Countries\US
  • Programming Language:C, Java, C++, PHP, Python, JavaScript

Posted 01 August 2012 - 09:39 AM

I believe the href attribute is required for valid html.

# will indeed scroll to top.
javascript:void(); will not.


In my scripts I usually don't use the A element at all; using a SPAN element with some custom styles and attributes works pretty well for me.
  • 0
Regards,
RR

#6 JackomoLight

JackomoLight

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 97 posts
  • Programming Language:PHP, Python, JavaScript, PL/SQL
  • Learning:C, Java, C++, Perl, Ruby, Lisp, Bash

Posted 02 August 2012 - 11:37 AM

Not for valid html but xhtml. Anyway it doesn't matter in my case.
  • 0





Also tagged with one or more of these keywords: gallery

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download