Giter VIP home page Giter VIP logo

Comments (1)

aceckert avatar aceckert commented on July 27, 2024

I realize this is an old question but I figured I'd throw out how I added button controls. Someone may find it useful someday.

I had a long swipe and wanted bookmarks at the bottom to jump to different pages.

I used jquery to locate the carousel, since it renames it and you lose your IDs.

I put it in a div called "swiper" and used that as my starting point. the carousel will be placed in a unnamed div. I suppose if you have one carousel on a page you could add code to the carousel script to add an id to the div or ul.

on my buttons I added a function that passes a number and calculates the new left CSS, which if you what the code in a browser inspector is the number that changes. I multiple the -width of a single page by the passed number. if I want page 1 i pass a 0, page 3 is 2, etc.

function jumper(c){
var distance = -1910 * c;
var myCarousel = $("div#swiper > div:first > ul:first");
console.log(myCarousel.width());
myCarousel.css("left", distance +"px");
}

for just next and previous you could set a variable at 0 and onclick of next add a +1 and pass it to a similar function.

from jquerymobile-carousel.

Related Issues (6)

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.