Jump to content

Content Slider - help adjusting


Canman2005

Recommended Posts

hi all

 

we have a featured content slider script.

 

My html page has 14 sections to a BIG form and we have used to content slider so that once you have complete section 1 of the form, you can click the next link (or one of the page numbers) and it will take you to the next part of the form, you keep doing this until you reach section 14 (page 14) and then there is a submit on page 14 which then dumps all the form data into a sql database.

 

The problem I have is that I have the page numbers and a next button which allows you to move through the form, it looks like

 

1  2  3  4  5  6  7  8  9  10  11 12  13  14  next

 

once your on section 14, if you click the `next` link, it takes you back to page 1.

 

the problem im running into, is that when people reach section 14, they are clicking the next button thinking that it will submit the form, where as it's not, when they click next on section 14, it takes them back to section 1.

 

what i want to do is to remove the link `next` when they reach section 14, or make the next link different on section 14 than it is on the other sections, so that clicking next while on page 10 for example, would take you to step 11, but clicking next on step 14 would contain a link which could submit the form.

 

the code I use in my page to generate the page numbers and next link is

 

<script type="text/javascript">
ContentSlider.buildpagination=function(sliderid){
var slider=document.getElementById(sliderid)
var paginatediv=document.getElementById("paginate-"+sliderid) //reference corresponding pagination DIV for slider
var pcontent=""
pcontent+='<span class=people-content><strong>Page</strong></span>  '
for (var i=0; i<slidernodes[sliderid].length; i++) //For each DIV within slider, generate a pagination link
pcontent+='<a href="#" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', '+i+'); return false\">'+(slider.paginateText? slider.paginateText[i] : i+1)+'</a>'
pcontent+='<span class=people-content><a href="#" style="font-weight: bold;" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', parseInt(this.getAttribute(\'rel\'))); return false\">'+(slider.nextText || "Next")+'</a></span>'
paginatediv.innerHTML=pcontent
paginatediv.onclick=function(){ //cancel auto run sequence (if defined) when user clicks on pagination DIV
if (typeof window[sliderid+"timer"]!="undefined")
clearTimeout(window[sliderid+"timer"])
}
}
ContentSlider("slider2")
</script>

 

I have been hacking at this for ages, with no luck, i tried to use a if statement, but im really new to jscript modication, so its becoming a hard one to crack.

 

if anyone can help that would be ace

 

thanks in advance

 

ed

Link to comment
Share on other sites

provide your entire code - I believe all you will need is a if else condition to check for the pagination number.

 

off the top of my head - without looking at the full code - something like this:

 

var maxedout = slidernodes[sliderid].length;
if (i == maxedout)
{
pcontent+='<span class=people-content><a href="#" style="font-weight: bold;" onClick=\"javascript:void(0)\">'+(slider.nextText || "Next")+'</a></span>'
}
else {
pcontent+='<span class=people-content><a href="#" style="font-weight: bold;" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', parseInt(this.getAttribute(\'rel\'))); return false\">'+(slider.nextText || "Next")+'</a></span>'
}

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.