2

When we are building html5 web app or ios hybrid app,we need to make an effect like the views' transition in an ios app.

Such as : http://jquerymobile.com/demos/1.1.0/docs/pages/page-transitions.html

In the past I use jquery mobile or sencha touch to handle it.

But,you know,jquery mobile depends on many libraries or css.(Like: jquery, jquerymobile.css etc.) and sencha touch is too heavy.

I just wanna find a simple javascript library which can help me to handle this problem.

I also wish this library is pure and easy to use.

Is there a javascript library can handle this problem?:-)

CashLee李秉骏
  • 1,038
  • 1
  • 10
  • 23

3 Answers3

1

Maybe this can help you: HTML Page Slide Without a Framework

The solution is pretty lightweight and is powered by a little AJAX, some CSS transitions, and CSS transition events. It's also important to note that this only works with WebKit. (This case is for a mobile application with PhoneGap targeting Android and iOS, so it only need WebKit compatibility.)

WeiShai
  • 26
  • 3
0

Something like this one?

http://buildinternet.com/project/supersized/slideshow/3.2/demo.html

jQuery should generaly be the best choice as it'll ensure it works cross browser and platform .

Brian
  • 8,418
  • 2
  • 25
  • 32
0

You might wanna take a look at Swipe, especially since this will also be for iOS, because it detects the swipes and the demo shows support for slides.

There was some other good solutions presented here, on Stack Overflow, on this question: Sliding An Entire Web Page You might want to take a look at the answers there, the accepted one does the sliding for entire pages

[edit]Depending on your skills, you could try to make your own vanilla (pure) javascript functions for the sliding. That's what I ended up doing, using the html5's translate3d css property.

For example, here's the function I use to generate the css codes:

//generates transformation styles for Opera, Chrome, Firefox and IE
function genTransform (x, y, z, dur) {
    var genStyle = '-webkit-transform: translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px); -webkit-transition: ' + dur + 'ms;' + 
                '-moz-transform: translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px); -moz-transition: ' + dur + 'ms;' + 
                '-ms-transform: translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px); -ms-transition: ' + dur + 'ms;' + 
                '-o-transform: translate(' + x + 'px, ' + y + 'px); -o-transition: ' + dur + 'ms;' +
                'transform: translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px); transition: ' + dur + 'ms;';

    return genStyle;
}

I then apply the style to my divs to get them to slide according to my needs. It's actually very simple if you only slide between a set number of pages

Community
  • 1
  • 1
BBog
  • 3,630
  • 5
  • 33
  • 64