Skip navigation
ljlindhurst
Currently Being Moderated

Spry Sliding Panels--how to get it to repeat at the end?

Apr 11, 2008 12:50 PM

I have a beautiful working Sliding Panels set up--you can see it at: http://www.traditional-building.com/index-anim.htm (Scroll down to "Browse the Product Gallery")(and no, I did not design this attrocious, table-riffic site!). My question is, when I get to the last panel, how do I get it to automatically start over at the first panel? I can't seem to figure this out...

thanks!
 
Replies
  • Currently Being Moderated
    Apr 15, 2008 9:50 PM   in reply to ljlindhurst
    Hi ljlindhurst,

    Since none of the geniuses have answered your question, I'll give it a try. :-P

    Add this function to your page. And call it from your "Next" link.


    function NextPanel()
    {
    var curPanel = sp1.getCurrentPanel();
    var newPanel = sp1.showNextPanel();
    if (curPanel == newPanel)
    sp1.showFirstPanel();
    }


    --== Kin ==--
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 15, 2008 10:25 PM   in reply to ljlindhurst
    I was looking for this as well,
    Thks,
    Bisser
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2008 3:58 PM   in reply to ljlindhurst
    You place the function in one of the <script> tags in the <head> of your document. For example, you can add it to the end of the script tag that contains the MM_openBrWindow() function.

    When I said your "Next" link, I meant the markup that looks like this:

    <a href="#" onclick="sp1.showNextPanel(); return false;">Next ...

    Make it look like this:

    <a href="#" onclick="NextPanel(); return false;">Next ...

    --== Kin ==--
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2008 7:58 AM   in reply to ljlindhurst
    Browse the Product Galleries
    next button works perfect here..
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2008 9:34 AM   in reply to ljlindhurst
    Firstly, I am a JS cut and paste hack artist. So I'm sure this could be better.
    Second, I haven't figured out how to make sliding panels one continuous loop. That would be nice eh? But I do have the buttons link back to the first panel at the end.

    Here is the page:
    www.goehnergroup.com/gg/

    There are several mods to sliding panels here:
    1. Two panels are being controlled by the same button. I had to create a new function to fire both at the same time.
    2. The animation is a custom sequence
    3. It is set to slide automatically after 5 seconds (in case a user missed the arrows).
    4. And it goes back to the first panel at the end.
    The code below just does #4. If you're interested in the other things, check the source on the link above.

    NOTE: this code assumes that the slider in question is called sp2 (I used example 2). You'd need to change all references in the following code from sp2 to whatever you called it.

    Here is what the javascript looks like (drop inside the head tags of your html):
    <script type="text/javascript">

    function moveNext(){
    var idx = sp2.getContentPanelIndex(sp2.currentPanel);
    var maxPanels = sp2.getContentPanels().length - 1;
    if (maxPanels == idx)
    {
    sp2.showFirstPanel();
    }
    else
    {
    sp2.showNextPanel();
    }
    }

    function movePrev(){
    var idx = sp2.getContentPanelIndex(sp2.currentPanel);
    if (0 == idx)
    {
    sp2.showLastPanel();
    }
    else
    {
    sp2.showPreviousPanel();
    }

    }
    </script>


    Here is what the nav links look like (drop into the html):

    <a href="#" onclick="moveNext();">Next</a>
    <a href="#" onclick="movePrev();">Prev</a>
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2008 9:34 AM   in reply to ljlindhurst
    DOUBLE POST -- See I am a cut and paster :-)
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 22, 2008 3:18 PM   in reply to ljlindhurst
    Hi ljlindhurst,

    I just went to your site:

    http://www.traditional-building.com/index-anim.htm

    and I see it going to the first image when you get to the end. Is that not what you wanted? Or are you expecting what is typically called a carrousel effect where as you get to the last image, the first one appears to come immediately *AFTER* the last image?

    If what you are looking for is a carrousel, that isn't what this widget was about, and it would take some JS modifications to make it work the way you want it to work.

    --== Kin ==--
     
    |
    Mark as:
  • Currently Being Moderated
    May 15, 2011 7:28 AM   in reply to kinblas

    Hi Kin,

     

    ljlindhurst posted this http://forums.adobe.com/message/97681# back in April 2008 without a positive conclusion.  It looks like the same conundrum that I posted a couple of days ago http://forums.adobe.com/thread/851757  :

     

    “  Spry SlidingPanels

    By default, after the last panel has displayed The Spry slidingPanels Widget causes the panels to zoom backward (visibly) through all the panels to arrive back at the first panel (sp1) to start the cycle again !?

     

    Well I don't see any sliding panels on line that do that these days, thank goodness, they all transition (continue) from the last to the first panel without a break or “reverse zoom” !    So what am I missing?  “

     

    Your reply to ljlindhurst started with the following line:

         “Since none of the geniuses have answered your question, I'll give it a try. :-P “

     

    Well I appreciate your humor and greatly respect all the work you do on the forums, as I suspect many of us do.

     

    So could you please revisit this item and have a stab at the javascript or code that will make this needed action work.

     

    Thanks in anticipation.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2011 3:44 PM   in reply to tunedup

    I too am hoping what tunedup is asking for could be done.

     

    Until then, i got the next panel to work where it loops back to the beginging, how can i get the previous panel to do the same and loop back to the end?

     

    So far this is what i have but its not working:

     

    function NextPanel()

    {

    var curPanel = sp1.getCurrentPanel();

    var newPanel = sp1.showNextPanel();

    if (curPanel == newPanel)

    sp1.showFirstPanel();

    }

    function PreviousPanel()

    {

    var curPanel = sp1.getCurrentPanel();

    var newPanel = sp1.showPreviousPanel();

    if (curPanel == newPanel)

    sp1.showLastPanel();

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points