/    Sign up×
Community /Pin to ProfileBookmark

Help needed with script

Dear members, I’ve been losing hair over this one, need help! I found this jquery “tabs script” which also fades between the content DIVs. I want the ‘Next’ and ‘Previous’ DIVs to reside on the same page as the fading content (and it does right now) and this part is working. However the ‘selectors link-section’ at the bottom (DIV one, two, three and four) I want to move to another page (thumbnail gallery), giving me a thumbnail page, which when clicking on am images takes my to that specific div/img on page 2, showing the larger image and the next and previous buttons below it.
Does anyone know how to make such a link, like <a href=”page2.html#specific img”>Thumnail img</a> (that one of course doesn’t work)
Grateful for any feedback. This is my script:

latest jquery.min.js + this jquery:

jQuery(document).ready(function() {

// initialise variables
var index = 0;
var nextIndex = 0;

// fade out current detail and fade in the next detail
fadeInOut = function() {
$(‘.detail:eq(‘+index+’)’).fadeOut(500,
function() {
index = nextIndex;
$(‘.detail:eq(‘+index+’)’).fadeIn(500);
}
)
}

// show selected detail
$(‘.selector’).click(function(){
nextIndex = $(‘.selector’).index($(this));
fadeInOut();
});

// move to previous detail
$(‘#previous’).click(function(){
nextIndex -= 1;
if (nextIndex < 0) nextIndex = 3;
fadeInOut();
})

// move to next detail
$(‘#next’).click(function(){
nextIndex += 1;
if (nextIndex > 3) nextIndex = 0;
fadeInOut();
})

// initially show first detail
$(‘.detail:eq(0)’).show();

});

… And the HTML…

<div id=”outer”>
<div class=”detail”>First section</div>
<div class=”detail”>Second section</div>
<div class=”detail”>Third section</div>
<div class=”detail”>Fourth section</div>
</div>
</td></tr></tbody>
</table>

<div class=”selector”>one</div>
<div class=”selector”>two</div>
<div class=”selector”>three</div>
<div class=”selector”>four</div>

Thankful for any advise. Best regards Kullman

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @kullman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...