Git Product home page Git Product logo

Comments (5)

rusteater avatar rusteater commented on July 18, 2024

For reference's sake; I'm using the latest build of jQuery: 1.7.2

from responsiveslides.js.

arielsalminen avatar arielsalminen commented on July 18, 2024

Can you tell me what you are trying to achieve/do to the "current slide"? would be easier to help : )

from responsiveslides.js.

rusteater avatar rusteater commented on July 18, 2024

I have other elements on the page that I want to change/move/scale together with the change of the slides.
In order to synchronize them, I want to run my code in the before/after callback. I have to know which slide is currently being shown in order to know which elements to move where etc.

from responsiveslides.js.

arielsalminen avatar arielsalminen commented on July 18, 2024

It's a bit hard right now, but here's a short example how it would be possible (this will be easier once I get the 2.0 plugin out, but that might take a while):

$(".rslides3").responsiveSlides({
  auto: false,
  nav: true,
  before: function () {
    var currentSlide = $("." + this.namespace + "1_on").attr("id");
    console.log("Started animating from '#" + currentSlide + "' to the next");
  },
  after: function () {
    var currentSlide = $("." + this.namespace + "1_on").attr("id");
    console.log("Stopped animating and you are seeing '#" + currentSlide + "'");
  }
});

And if you want to execute something, for example, when the first and the second slide start animating:

before: function () { 
  // If we are seeing the 1st slide
  if ($("#" + this.namespace + "1_s0").hasClass(this.namespace + "1_on")) {
    console.log("First slide started animating");
    // Now do something here...
  }        
  // If we are seeing the 2nd slide
  if ($("#" + this.namespace + "1_s1").hasClass(this.namespace + "1_on")) {
    console.log("Second slide started animating");
    // Do something else here...
  }
}

Hope that helps… :)

from responsiveslides.js.

flo1337 avatar flo1337 commented on July 18, 2024

Would be nice if it works without "1_on".
I've got 2 or more Slideshows on one page.
And I have a page like "page 1 of 4" - in each slideshow.
How would I do that?

Indeed, this works for ONE slideshow but not for many:
after: function(){
var currentSlide = $("." + this.namespace + "1_on").attr("id");
$(".slideshow-container .slide-count .one").html($(".slideshow-container-body").find("li#" + currentSlide).index() + 1);
}

from responsiveslides.js.

Related Issues (20)

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.