Coder Social home page Coder Social logo

Comments (7)

bigsweater avatar bigsweater commented on June 2, 2024

Apologies: tried to label this with "Questions" but I don't think I can, without being an admin.

from jquery-rf-slideshow.

ryanflorence avatar ryanflorence commented on June 2, 2024

Hey @bigsweater, try this:

$(document).ready(function() {

    var slideImages = $('.slideCaptions > .slides, .slideImages > .slides');
    var slideHeadlines = $('.slideHeadlines > .slides');

    slideImages.slideshow({
        transition: 'push(left, false, ease)', // blind(direction, fade, ease)
        autoStyle: true, // handle some basic styles for you
        duration: 800 // duration of a transition
    });

    slideHeadlines.slideshow({
        transition: 'push(right, false, ease)', // blind(direction, fade, ease)
        autoStyle: true, // handle some basic styles for you
        duration: 800 // duration of a transition
    });

    function showNext() {
        slideImages.slideshow( 'show', 'next' );
        slideHeadlines.slideshow( 'show', 'next' );
        console.log("Done!");
    }

    var slidesInterval = setInterval( showNext, 3000 );

    $( '.sliderNext' ).click(function(){
        slideImages.slideshow( 'show', 'next' );
        slideHeadlines.slideshow( 'show', 'next', {
            transition:'push(right)'
        } );

    // or slideshowElement.slideshow( 'show', 'next' );
    });

    $( '.sliderPrev' ).click(function(){
        slideImages.slideshow( 'show', 'previous', {
            transition:'push(right)'
        } );

        slideHeadlines.slideshow( 'show', 'previous', {
            transition:'push(left)'
        } );
    // or slideshowElement.slideshow( 'show', 'previous' );
    // etc.
    });

});

from jquery-rf-slideshow.

bigsweater avatar bigsweater commented on June 2, 2024

@rpflorence Awesome! Worked perfectly. Out of curiosity: why wouldn't wrapping the slider functions into one big fat function work? (Please pardon my ignorance—still learning JS.)

In case anybody else has a similar issue, the final script included a few different things: it pauses the sliders on hover, and resets the timer on prev/next, so there are no jarring transitions.

This script was easier to figure out than any of the five or so I've tried over the last few days. Was using the (really bloated) Cycle, and couldn't get it to do exactly what I wanted. It's really good to finally have a slider script that's this versatile and stuff. So, thanks.

from jquery-rf-slideshow.

ryanflorence avatar ryanflorence commented on June 2, 2024

Would love to provide a longer response, but I'm packing up my house to move! Basically you need to create a slideshow instance before you go calling methods on it.

from jquery-rf-slideshow.

bigsweater avatar bigsweater commented on June 2, 2024

That makes sense. Thanks again.

For the record, I'm in the (beginning) process of learning JavaScript, and I learned a lot by tinkering with this. Typically I'll opt for one of the more designer-friendly plugins, but this is definitely a great learning tool, though you might not have had that in mind when you built it.

Any plans to include some sort of mobile/CSS3/touch functionality, a la flexslider?

from jquery-rf-slideshow.

ryanflorence avatar ryanflorence commented on June 2, 2024

Cool. I personally don't use the jQuery UI API, I do it more like this:

var slideHeadlines = $('.slideHeadlines > .slides').slideshow({
    transition: 'push(right, false, ease)',
    autoStyle: true,
    duration: 800
}).data('slideshow'); // <-- gets the actual object so you can work
                      //     with it directly

slideHeadlines.show('next'); // v. slideHeadlines.slideshow('show', 'next')
slideHeadlines.show('next', { transition: 'push(right)' });

// and you can also console.log(slideHeadlines) to see what it actually is

Good luck!

from jquery-rf-slideshow.

bigsweater avatar bigsweater commented on June 2, 2024

Y'know, I saw that in the docs, but I was throwing spaghetti at the wall till something stuck, honestly. Couldn't get the more direct method to work, but I was doing it all wrong; now I can see the actual difference between this and the jQuery API. This way is fewer lines of code, too.

For anybody with the same question(s): the final-ish code is on Pastebin.

from jquery-rf-slideshow.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.