Thanks, Dave...explains it perfectly.

It was thinking of the remainder as a decimal or fraction
that was throwing me off...

Rick

-----Original Message-----
From: Dave Francis [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 22, 2006 7:14 PM
To: CF-Talk
Subject: RE: next and previous buttons for slideshow


Think of MOD as an integer operation which returns the remainder of a whole
number division rather than going to decimal places.

Thus 4 MOD 10 returns 4. And 14 MOD 10 also returns 4. Remember, it's just
the remainder.

Using MOD, the range of your returned numbers will, in this case, be zero to
9.

Now, when currentSlide is 10, 10 MOD 10 returns zero. Essentially "wrapping
round" to start at zero. The +1 at the end simply changes the range from 0-9
to 1-10.

Hope this helps.



-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 22, 2006 2:55 PM
To: CF-Talk
Subject: RE: next and previous buttons for slideshow


Thanks for the explanation.

Let's say that currentSlide is 4, totalSlides is 10...

So, cfset nextSlide = (4 MOD 10) + 1>

What resutl does the calculation 4 MOD 10 return?

It must be 4...but how?  What does the MOD do?

I read in the maual where it returns the remainder
of two numbers, e.g. MOD (integer1, interger2) = remainder interger1,
......don't quite understand that...but what does your
statement 4 MOD 10 return?

Rick

-----Original Message-----
From: Dave Francis [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 22, 2006 12:57 PM
To: CF-Talk
Subject: RE: next and previous buttons for slideshow


currentSlide is a URL param - needed on first entry and passed in the hrefs
therafter. Here's a quick-and-dirty working demo. You'll need to call it
"t11.cfm" or change the href's.



<cfset totalSlides=10>

<cfset nextSlide = (currentSlide MOD totalSlides) + 1>
<cfset prevSlide = (currentSlide - 1) + (totalSlides * (currentSlide eq 1))>

<cfoutput>
        NEXT:#nextSlide#&nbsp;&nbsp;
        CURR:#currentSlide#&nbsp;&nbsp;
        PREV:#prevSlide#

<p style="margin-left:60px;"/>
        <a 
href="t11.cfm?currentSlide=#prevSlide#">&lt;PREV</a>&nbsp;&nbsp;&nbsp;
        <a href="t11.cfm?currentSlide=#nextSlide#">NEXT&gt;</a>
</cfoutput>




-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 22, 2006 11:31 AM
To: CF-Talk
Subject: RE: next and previous buttons for slideshow


I've been following this thread because the method
of "next / previous" is better than what I currently use...so...

I was looking over the code below and I have a few questions...

How is the variable "currentSlide" being defined?  In assumed
previous code?

Also, would you put some hard numbers in there for me to view
how the functions are working?

TIA...

Rick



-----Original Message-----
From: Dave Francis [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 22, 2006 10:36 AM
To: CF-Talk
Subject: RE: next and previous buttons for slideshow


This should work:

        <cfset totalSlides=10>

        <cfset nextSlide = (currentSlide MOD totalSlides) + 1>
        <cfset prevSlide = (currentSlide - 1) + (totalSlides * (currentSlide eq
1))>




-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED]
Sent: Friday, April 21, 2006 4:45 PM
To: CF-Talk
Subject: RE: next and previous buttons for slideshow


Okay. I just condensed it into a CFC. now I don't have to look at that code
every time.

<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED]
Sent: Friday, April 21, 2006 3:35 PM
To: CF-Talk
Subject: RE: next and previous buttons for slideshow


Really?

Durnit...that sucks...it's sooo clunky.














~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238479
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to