You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Scrollable: how to stop and play scrollable functionality Created Jul 14, 2009

This thread is solved

Views: 4031     Replies: 8     Last reply Jan 13, 2010  
You must login first before you can use this feature

luigi.croce

Posts: 14

Registered:
Feb 20, 2009

Scrollable: how to stop and play scrollable functionality

Posted: Jul 14, 2009

Hello,
I'm new to jquery but I liked very much flowplayer and scrollable tool.
My problem is that I use in a page the keynav navigation script (show quicly in the following page:
http://amountaintop.com/jquery-keyboard-navigation-plugin
and I would like to use it in the same page where there is also the scrollable tool.
The problem is that if I use the right/left arrow to move in the link of the page with the key-navigation, also the scrollable move, and I would like it to move only wen I want to.

So, i'm trying to find a way to start and stop scrolling funtionality with the executing of a Javascript function.

Is there a way to do that?

Thank you very much.

Luigi

Christian Ebert
Flowplayer support

Posts: 2803

Registered:
May 27, 2008

» Scrollable: how to stop and play scrollable functionality

Posted: Jul 14, 2009

Reply to: Scrollable: how to stop and play scrollable functionality, from luigi.croce
More or less pseudo-code:


var sc = $("div.scrollable").scrollable({
  // make api accessable
  api: true
});

function myfunc() {
  // disable scrolling by pressing arrow keys
  sc.getConf().keyboard = false;
  // you MIGHT get away without the next line, please test
  sc.reload();
  // do your script stuff ...
  // afterwards reset arrow key functionality for scrollable
  sc.getConf().keyboard = true;
  // again, only insert following line if needed
  sc.reload();
}

luigi.croce

Posts: 14

Registered:
Feb 20, 2009

» » Scrollable: how to stop and play scrollable functionality

Posted: Jul 14, 2009

Reply to: » Scrollable: how to stop and play scrollable functionality, from blacktrash
This solution do not work!!!!
I don't know why!!!

that is my code:

$(function() {		
		// initialize scrollable 
		var sc = $("div.scrollable").scrollable({
				api: true,
				size: 5,
				items: '#thumbs',  
				hoverClass: 'hover',
				keyboard: false
			});	
		var scroll = false;
		$("#scrolla").click(function() {

			if (scroll) {
				sc.getConf().keyboard = false; 
				sc.reload(); 
				scroll = false;
			}
			else {
				sc.getConf().keyboard = true; 
				sc.reload();
				scroll = true; 
			}
		}); 
				

	});

luigi.croce

Posts: 14

Registered:
Feb 20, 2009

» » » Scrollable: how to stop and play scrollable functionality

Posted: Jul 14, 2009

Reply to: » » Scrollable: how to stop and play scrollable functionality, from luigi.croce
I also tried removing "keyboard: false " in the initialization of the scrollable...

Christian Ebert
Flowplayer support

Posts: 2803

Registered:
May 27, 2008

Bug in scrollable.getConf() dynamic config?

Posted: Jul 14, 2009

Reply to: » » Scrollable: how to stop and play scrollable functionality, from luigi.croce
I tested now and can't get it to work either. According to the docs and examples the reload() should not be needed (only for adding and removing items).

I believe this qualifies as a bug, unless I'm overlooking something very obvious (which usually is the case ;-) )

I tested with this simple function which alerts the right values but doesn't actually change the keyboard functionality:


var s = $("div.scrollable").scrollable({api: true});

$("button").click(function () {
  // try to toggle arrow functionality of scrollable
  var k = s.getConf().keyboard;
  s.getConf().keyboard = k ? false : true;
  // the alert reflects the change
  alert(s.getConf().keyboard);
  // s.reload(); // doesn't make any difference
}

luigi.croce

Posts: 14

Registered:
Feb 20, 2009

» Bug in scrollable.getConf() dynamic config?

Posted: Jul 14, 2009

Reply to: Bug in scrollable.getConf() dynamic config?, from blacktrash
mmm...
who should take care of this bug?
is there the possibility to correct it by ourself?

luigi.croce

Posts: 14

Registered:
Feb 20, 2009

» » Bug in scrollable.getConf() dynamic config?

Posted: Jul 16, 2009

Reply to: » Bug in scrollable.getConf() dynamic config?, from luigi.croce
I solved this bug by my self:

I created in the seekTo section of the library this two function:

startKeyboard: function() {
				$(document).unbind("keydown.scrollable").bind("keydown.scrollable", function(evt) {
					
					var el = current;	
					if (!el || evt.altKey || evt.ctrlKey) { return; }
						
					if (horizontal && (evt.keyCode == 37 || evt.keyCode == 39)) {					
						el.move(evt.keyCode == 37 ? -1 : 1);
						return evt.preventDefault();
					}	
					
					if (!horizontal && (evt.keyCode == 38 || evt.keyCode == 40)) {
						el.move(evt.keyCode == 38 ? -1 : 1);
						return evt.preventDefault();
					}
					
					return true;
					
				});	
			},
			stopKeyboard: function() {
				$(document).unbind("keydown.scrollable");
			},

With that I can prevent the not working keyboard property.

sutton

Posts: 2

Registered:
Jan 12, 2010

» » » Bug in scrollable.getConf() dynamic config?

Posted: Jan 12, 2010

Reply to: » » Bug in scrollable.getConf() dynamic config?, from luigi.croce
Hey, Luigi... Do you mind telling me exactly where to put this in the code? I'm not getting much luck getting this to work.

Thanks!

luigi.croce

Posts: 14

Registered:
Feb 20, 2009

» » » » Bug in scrollable.getConf() dynamic config?

Posted: Jan 13, 2010

Reply to: » » » Bug in scrollable.getConf() dynamic config?, from sutton
I worked on it a long time a go...
but if I remember correctly with the latesta scroller package this bug was solved...

I used this function...


		keyboardToggle = function() {
			var k = sc.getConf().keyboard;  
			sc.getConf().keyboard = k ? false : true;
			sc.reload;
		}


I hope to be helpfull...
bye...

Luigi