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

Home Forums JavaScript Jquery Slider Div Re: Jquery Slider Div


I made something like this to get you started:

$(function() {
// hides every ‘page’ except the :target
$(‘#one, #two, #three’).not(‘:target’).hide();
// current ‘page’ as jQuery object is :target or null
var current = $(‘:target’);
// make sure to change the selector for the click event
$(‘a’).click(function() {
// next ‘page’ as jQuery object
var next = $($(this).attr(‘href’));

if (current) {
if (current[0] == next[0])
// we are already on the ‘page’
// hide current ‘page’ (can add some slide logic here)
// show next ‘page’ (slide logic here too)
current = next;;

Without sliding functionality though, it’s just to get you started. I think this also works if some one comes to the page with target, haven’t tested though (target is like blabla/page.html#target_id), but that’s why I removed preventDefault stuff.