Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-13-2008, 09:25 PM   PM User | #1
StealthRT
Regular Coder

 
StealthRT's Avatar
 
Join Date: Aug 2006
Posts: 175
Thanks: 13
Thanked 0 Times in 0 Posts
StealthRT can only hope to improve
Exclamation JQuery adding keycode to navigate spacegallery

Hey all i am in need of some help trying to figure out how i can put a keycode inside the Spacegallery jQuery javascript so that i dont have to use my mouse to navigate through the images. I would like to use the Down Arrow key on the keyboard to take the place of the mouse clicks.

The Spacegallery can be found @ http://www.eyecon.ro/spacegallery

Here's the part of the code that forms the click event for the images.
Code:
                        init: function(opt) {
                                opt = $.extend({}, EYE.spacegallery.defaults, opt||{});
                                return this.each(function(){
                                        var el = this;
                                        if ($(el).is('.spacegallery')) {
                                                $('<a href="#"></a>')
                                                        .appendTo(this)
                                                        .addClass(opt.loadingClass)
                                                        .bind('click', EYE.spacegallery.next);
                                                el.spacegalleryCfg = opt;
                                                el.spacegalleryCfg.images = el.getElementsByTagName('img').length;
                                                el.spacegalleryCfg.loaded = 0;
                                                el.spacegalleryCfg.asin = Math.asin(1);
                                                el.spacegalleryCfg.asins = {};
                                                el.spacegalleryCfg.tops = {};
                                                el.spacegalleryCfg.increment = parseInt(el.spacegalleryCfg.perspective/el.spacegalleryCfg.images, 10);
                                                var top = 0;
                                                $('img', el)
                                                        .each(function(nr){
                                                                var imgEl = new Image();
                                                                var elImg = this;
                                                                el.spacegalleryCfg.asins[nr] = 1 - Math.asin((nr+1)/el.spacegalleryCfg.images)/el.spacegalleryCfg.asin;
                                                                top += el.spacegalleryCfg.increment - el.spacegalleryCfg.increment * el.spacegalleryCfg.asins[nr];
                                                                el.spacegalleryCfg.tops[nr] = top;
                                                                elImg.spacegallery = {};
                                                                imgEl.src = this.src;
                                                                if (imgEl.complete) {
                                                                        el.spacegalleryCfg.loaded ++;
                                                                        elImg.spacegallery.origWidth = imgEl.width;
                                                                        elImg.spacegallery.origHeight = imgEl.height
                                                                } else {
                                                                        imgEl.onload = function() {
                                                                                el.spacegalleryCfg.loaded ++;
                                                                                elImg.spacegallery.origWidth = imgEl.width;
                                                                                elImg.spacegallery.origHeight = imgEl.height
                                                                                if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) {
                                                                                
                                                                                        EYE.spacegallery.positionImages(el);
                                                                                }
                                                                        };
                                                                }
                                                        });
                                                el.spacegalleryCfg.asins[el.spacegalleryCfg.images] = el.spacegalleryCfg.asins[el.spacegalleryCfg.images - 1] * 1.3;
                                                el.spacegalleryCfg.tops[el.spacegalleryCfg.images] = el.spacegalleryCfg.tops[el.spacegalleryCfg.images - 1] * 1.3;
                                                if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) {
                                                        EYE.spacegallery.positionImages(el);
                                                }
                                        }
                                });
                        }
Any help would be great!!!

David
StealthRT is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:32 AM.


Advertisement
Log in to turn off these ads.