Debugging a jquery carousel page scroll

24 views
Skip to first unread message

Lorin Rivers

unread,
May 2, 2012, 4:11:38 PM5/2/12
to refresh...@googlegroups.com, WordPress Austin
Geniuses,

I have a WordPress site that uses a plugin that uses jQuery and Pikachoose and some other magic to make some slideshow/carousel objects.

On a page like this one: <http://more.andrewyates.com/photography/location/> if the page is partially scrolled down, when you click the bottom thumbnails, the page will scroll up when the image loads, almost like there's an anchor tag url in play. I can't figure out where this is coming from and my JS debugging is not very strong.

Any ideas?
--
Lorin Rivers
Mosasaur: Killer Technical Marketing <http://www.mosasaur.com>
<mailto:lri...@mosasaur.com>
512/203.3198 (m)


Meghan Southerland

unread,
May 2, 2012, 4:18:37 PM5/2/12
to refresh...@googlegroups.com
I would try adding a "return false;" at the end of the click handler. 

Meghan

--
Our Web site: http://www.RefreshAustin.org/

You received this message because you are subscribed to the Google Groups "Refresh Austin" group.

[ Posting ]
To post to this group, send email to Refresh...@googlegroups.com
Job-related postings should follow http://tr.im/refreshaustinjobspolicy
We do not accept job posts from recruiters.

[ Unsubscribe ]
To unsubscribe from this group, send email to Refresh-Austi...@googlegroups.com

[ More Info ]
For more options, visit this group at http://groups.google.com/group/Refresh-Austin

Keith Aric Hall

unread,
May 2, 2012, 4:51:31 PM5/2/12
to refresh...@googlegroups.com, WordPress Austin
I recommend using the uncompressed version ( jquery.pikachoose.full.js) for dev and debugging. Then switch to the compressed version for production.

kah

John Fawcett

unread,
May 2, 2012, 5:25:14 PM5/2/12
to refresh...@googlegroups.com
As Meghan said, add return false to the end of your click handler.

Additionally, I would also use stopPropagation and preventDefault. Your click handler should look something like:

function(e){
e.preventDefault();
e.stopPropagation();
// Your code
return false;
}

-john

Garann

unread,
May 8, 2012, 4:13:35 PM5/8/12
to Refresh Austin
In a jQuery event handler, return false is the same as adding both
e.preventDefault() and e.stopPropagation(). You need at most one of
the three, depending on whether you want to stop the default behavior,
the event bubbling (propagation), neither, or both. If you want the
code in your event handler to be the only thing that happens when that
event is triggered, use return false.

Garann
Reply all
Reply to author
Forward
0 new messages