Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

new direction parameter #233

Closed
Spica2 opened this issue May 4, 2012 · 4 comments
Closed

new direction parameter #233

Spica2 opened this issue May 4, 2012 · 4 comments

Comments

@Spica2
Copy link

Spica2 commented May 4, 2012

Is there any example how to use the new direction parameter, e.g. as an update to http://jsfiddle.net/xZBBS/

@fancyapps
Copy link
Owner

The latest code (https://github.com/fancyapps/fancyBox/zipball/master) contains feature that allows to specify direction, like -

$.fancybox.next('right'); 
$.fancybox.prev('left'); 
$.fancybox.jumpto(0, 'up'); 

Possible directions - up / right / down / left

Option keys indicates direction for each navigation key, keys for slideshow and switching fullscreen. Default values are -

keys  : {
    next : {
        13 : 'right', // enter
        34 : 'down',  // page down
        39 : 'right', // right arrow
        40 : 'down'   // down arrow
    },
    prev : {
        8  : 'left', // backspace
        33 : 'up',   // page up
        37 : 'left', // left arrow
        38 : 'up'    // up arrow
    },
    close  : [27], // escape key
    play   : [32], // space - toggles slideshow
    toggle : [70]  // letter "f" - toggles fullscreen
}

@Spica2
Copy link
Author

Spica2 commented May 4, 2012

Thats a nice feature. So I dont need the custom transitions any more.

Is there also a way to change the next direction from right to left as an option. In the main script this would mean

next: function ( direction ) { if (!isString(direction)) { direction = 'left'; }

@fancyapps
Copy link
Owner

There is no currently such option, do you really need it?

Btw, you can rewrite any method. If you would include this snippet after including fancybox.js file then default direction would be "up" -

$.fancybox.next = function ( direction ) {
    if (!direction) {
        direction = 'up';
    }

    if ($.fancybox.current) {
        $.fancybox.jumpto($.fancybox.current.index + 1, direction, 'next');
    }
};

@j0hnsmith
Copy link

@fancyapps I don't understand how to use the direction param to have an openMethod of slide down and a closeMethod of slide up, can you provide an example?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants