Code Monkey home page Code Monkey logo

curtain.js's Introduction

Curtain.js (The plugin is no longer maintained)

This plugin allows you to create a web page with multiple fixed panels that unroll with an amusing effect. Exactly like a curtain rises.

To navigate, you can use your keyboard instead the scrollbar or mousewheel to navigate into the document. But that's not all, there is more features! For example, you can easily add a fixed element or multiple "steps" element inside a pannel.

Feel free to fork the project on github or ping me on twitter for any comments.

Click here to lend your support to: Curtain.js and make a donation at www.pledgie.com !

Demonstrations

Site using Curtain.js

Documentation

Basic Usage

Usage is very straightforward, simply include curtain.js file in the page, along with jQuery.

<script src="js/libs/jquery.js"></script>  
<script src="js/libs/curtain.js"></script>

And don't forget to add the base stylesheet

<link rel="stylesheet" href="curtain.css">

Then call $('.curtains').curtain(); to launch the plugin. You can add a set of optional options.

Options

Valid options for curtain.js are:

  • scrollSpeed - Adjust the scroll speed (default 400)
  • menu - Bind event on "up" or "down" button (default null)
  • curtainLinks - If you want add a <a> (or multiple) link to a specific panel simply add a class name to this option. Take a look of the example bellow.(default '.curtain-links')
  • enableKeys - Enable/Disable keyboard navigation (default true)
  • easing - Change this option to specify the easing function used by jQuery animate calls. (defaults swing) (You muse use jQuery easing plugin or similar to have more easing functions)

Example

Setup the correct element structure:

<ol class="curtains">
    <li class="cover"> 
        your content
    </li>
    <li>
        <div class="fixed"> <!-- if you need a "fixed" content -->
            a fixed content
        </div>
        [...]
    </li>
    <li class="cover">
       [...]
    </li>
    <li >
        <ul>
            <li class="step"> ... </li> <!-- Add the class "step" to an element to  -->
            <li class="step"> ... </li> <!-- make a break at this point with keyboard controls  -->
        </ul>
    </li>
</ol>

Then, you can launch the plugin:

$(function () {
    $('.curtains').curtain({
        scrollSpeed: 400
    });
});

Features

Add a "next" and "prev" link

Insert your menu in your html document. You must use href="#up" and href="#down".

<ul class="menu">
    <li><a href="#up"></a></li>
    <li><a href="#down"></a></li>
</ul>

Then, you can launch the plugin and specify the class of your menu.

$(function () {
    $('.curtains').curtain({
        scrollSpeed: 400,
        controls: '.menu'
    });
});

Add a link to a specific panel

Simply add an id attribute to your panel:

<ol class="curtains">
    <li id="myfirstpanel" class="cover"> 
        your content
    </li>
    [...]
</ol>

Then you can add a link anywhere to your first panel like:

<ol class="curtains">
    [...]
    <li class="cover">
       <a href="#myfirstpanel" class="curtain-links">Go to first panel</a>
    </li>
</ol>

Then, you can launch the plugin and specify the class of your links.

$(function () {
    $('.curtains').curtain({
        scrollSpeed: 400,
        curtainLinks: '.curtain-links'
    });
});

Add callbacks to slide change events

You can fire a callback when the slide changes

$('.curtains').curtains({
    nextSlide: function() { console.log('next slide'); },
    prevSlide: function() { console.log('previous slide')}
});

Compatibility

  • Safari
  • Firefox
  • Chrome
  • IE8/IE9
  • iOs (iPhone/iPad) but the curtain effect is disabled
  • Android (Chrome/Opera) but the curtain effect is disabled

Roadmap

  • Remove panels dynamically
  • Better android default browser support
  • scroll horizontally

Credits

Author

Victor Coulon or ping me on twitter http://twitter.com/_victa

Contributors

Inspirations

Licence

Licence MIT

curtain.js's People

Contributors

marcjae avatar puneetsl avatar thisisjohnbrown avatar victa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

curtain.js's Issues

Animation optimization for better performance

If you use transform3d for animation, the performance will be better. The transform3d property uses hardware acceleration.
thus, you can enable transitions to iPhone.

greeting :-)

NOTE: sorry, but i don't speak good the english ;-)

Reversing the curtain effect?

How can this be modified to make the curtain divs slide up to cover each other?

It's more than just reversing the z-index of the divs, but I just cant figure it out.

Googlemaps breaks curtain...

When implementing googlemaps on my basic curtain-based site, the page starts acting weird. The script doesn't go to the right anchors and the pages are losing background images etc.

This is what i'm using to implement my googlemaps.

<script type="text/javascript"> function initialize() { var myLatlng = new google.maps.LatLng(52.37659, 4.88747); var mapOptions = { zoom: 16, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions); } </script>

Not being disabled on iPad 3

I'm using curtain.js on my site at jknollwebservices.com and I don't think its being disabled and is causing some display problems.

IE7,8 not work

It seems the problem happen after the last few updates on curtain.js.
(Problem should start from the curtain.js version 1.3)
Try with the older version of curtain.js and it works quite well.

The problem easily found, just use IE7 or 8 and go to the demo link and u will see the page wholly dead without any scrolling.

Anyone can provide updates on this issue?

Site breaks

getting this message in browser console:

"TypeError: self.$elDatas[self.currentIndex] is undefined"

Site has a responsive layout. Because of the repositioning of the responsive elements im guessing that the overall height is screwed up and breaks. Does anyone has this problem?

Content didn't shows while scrolling on Iphone

Hi.
It's an elegant script but it has some bugs.

First of all - content didn't appear while scrolling. Only when scrolling stopped, content start showing.
The second is - arrows dissapears when zooming on iphone.

p.s. sorry for my english.

Trigger the Browser Back-Button

Hi.

I it possible to append the browser back-button to the curtain slides? So when the user hits Back, it goes to the previous .cover

This would be awesome.

Last Background image//Chrome and FF

Hello,
All works great in Safari, But I have 5 backgrounds to cover full screen on 5 different panels, when i scroll to the last one it doesn't show up in Chrome or FF but does in safari...ideas?

Figure tag

Hi,

inserting a

tag in the html is causing page to stuck and scrolling is disabled.

Cheers

Alex

Problem with hashtags when scrolling.

Salut...

D'abord merci pour le code... Thanks for the code...

It seems I'm having a problem and I can't figure out if it's a bug or something I'm doing wrong.

When scrolling down, the URL #hastag doesn't seems to work properly since it doesn't change where it would suppose to.

I set up a page with an example at: http://www.gablabelle.com/wp-content/themes/gablabelle/curtain.php

I have 4 curtains

<ol class="curtains">
    <li id="intro"> 
    </li>

    <li id="latest"> 
    </li>

    <li id="services"> 
    </li>

    <li id="contact"> 
    </li>
</ol>

When I scroll to latest the hash doesn't change, when I almost get to services the hash changes for #latest, when I almost get to contact the hash changes for #services when I scroll the rest of the page nothing changes anymore. When I scroll back up it same thing but inverted.

On dirait que c'est décalé.

Merci beaucoup pour ton aide... Thanks for your help.

Reverse Curtain

Is it possible to reverse this?

So that next div slides on top of the current one?

Great plugin by the way 👍

Mobile (android support)?

Great plugin! Really like the effect an IE support.
But on my Mobile (Android) it does not work, any chance for mobile support?

How to load new block with ajax?

I would like to load new blocks with ajax, when scroll will be in some needed position.

After load this blocks, how I can recalculate all?

And how to change parent's block height (when blocks with class="step" were loaded)?

Thank You, Sorry for my English

Navigation based on target ID's ?

This isn't an issue, but I would love to see the ability to navigate with target links much like the scrollTo jquery plugin.

I actually made a website with this exact effect in my mind with the curtain appearance but mine has anchor links that link to DOM elements via IDs however, I believe that yours is done much more efficiently. I would love to see that functionality implemented.

Just a little note.

curtain effect on iOS

can anyone provide more detail on why the curtain effect does not currently work on iOS? Before i familiarize myself with the code im hoping to get an idea of what exactly prevents it from working properly. I have been developing a similar solution for iPad and would like to make an attempt at integrating it into curtain. I was running into issues with position: fixed and the scroll vs touchmove events, so im guessing the issues with curtain are similar.

So if anyone more familiar than I could give me a heads up it would be appreciated!

Delaying instantiation of plugin breaks it.

Hey Victor,

I'm playing around with your awesome little jQuery plugin and stumpled on this little bug:

$(function() {
    $('.curtains').curtain(); // works

    setTimeout(function() {
        $('.curtains').curtain(); // doesn't work
    }, 2000);
});

I've looked through the source but can't quite figure out why this happens. Any help is greatly appreciated :)

Remove #name from url

hi, i just implement curtain.js on a project and it works great
my question is, is there anyway to remove #anchorlinkname from browser url?
thanks a lot

How to scroll horizontal?

* I know this is not really an issue more of a "how to", but help would be appreciated :D*

Hey there,
I was wondering how I could enable scrolling horizontal. But only on one specific slide.

For example, you can scroll up and down my regular slides.
But when you reach my portfolio slide, you can get the option to scroll left / right.

Transition Lag in Chrome?

Hello, I am using your plugin on a site and have had problems in Chrome with the transition lag causing the navigation to function incorrectly. Essentially, it's a situation where the transition is completing programmatically, but not visually, and I didn't know if this is something that others have run into?

Any thoughts or ideas around this are greatly appreciated!

Curtain links don't work in Opera 11

Hi, brilliant plugin.
just noticed that the curtainlinks doesn't work in Opera 11.
I'm not very good with js to help sort it out, so please anyone help.
thanx.

Text under curtain

Hi, I'm using your plugin in a website I'm developing and everything works perfect except that when in one of the curtains the text is longer than the viewport, the curtain cuts it instead of letting scroll down till the text finishes like in your plugin website (http://curtain.victorcoulon.fr/). I've really tried to solve it by myself but I'm struggling with it. I don't know if it's much to ask to you if you can look at the code and tell me where I'm going wrong.
The website is http://www.epse.es/umhfest12 and in the 3rd curtain "Bases" is where I have the problem of the cutted text.

Solved. I just had to not write class="cover" in the li.

Sorry for the bothering.

thank you for your time and help in advance.

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.