Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Scrollable now accepts a "clones" setting. #866

Open
wants to merge 10 commits into from

6 participants

@oheard

This is a follow-up to my pull request yesterday. Rebased onto dev as requested and also fixed my use of spaces instead of tabs that wasn't included in yesterday's request. The original commit message is included below.

Regards,
Oli

-- Original Commit Message --
The "clones" setting configures the number of clone elements used on each side
of the items. E.g., clones=2 would create 4 clone elements, two on either side.

This is useful for visuals where "inactive" items are still visible on screen.
The previous behaviour only proved useful for transitioning between items when
only a single item is displayed pre/post-transition.

Oliver Heard and others added some commits
Oliver Heard Scrollable now accepts a "clones" setting.
The "clones" setting configures the number of clone elements used on each side
of the items. E.g., clones=2 would create 4 clone elements, two on either side.

This is useful for visuals where "inactive" items are still visible on screen.
The previous behaviour only proved useful for transitioning between items when
only a single item is displayed pre/post-transition.
b432b5b
@0liver 0liver added possibility to enclose tooltip element inside trigger element (…
…e.g. for table cells), incl. test
330192f
@brewt brewt Fix for clicking on the next/prev month when it's been disabled via v…
…isibility: hidden closes the calendar - target is the root node instead of the button.
a941165
@ewheeler ewheeler check each tooltip for existence, fixes issue 349
rather than checking if any tooltips already exist.
this way tooltips on some elements that are reloaded via
ajax calls will continue working. the previous code would
assume all tooltips still exist if *any* of the tooltips still
exist -- even if some of them no longer exist. now, part of a
page may be changed and can have new tooltips created instead
of only the ones for elements that did not change.

resolves: jquerytools#349

Signed-off-by: Adam Mckaig <adam.mckaig@gmail.com>
695f13a
@duclet duclet #480: Fixing readonly bug 66cdb8a
@lagrz lagrz When you have a mask currently open and close and need another opened…
… right after. Enables chaining using the onClose callback method
8e72b83
@duclet duclet Issue #563: Fixed ad4ee98
Oliver Heard Merge branch 'dev' of https://github.com/oheard/jquerytools into dev 61927a8
Oliver Heard Corrected whitespace in scrollable.js
I used spaces instead of tabs in my last commit, this fixes it.
df084b9
Oliver Heard Updated mousewheel to use event.originalEvent (changed since jQuery 1.1) c2ee335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 17, 2012
  1. Scrollable now accepts a "clones" setting.

    Oliver Heard authored
    The "clones" setting configures the number of clone elements used on each side
    of the items. E.g., clones=2 would create 4 clone elements, two on either side.
    
    This is useful for visuals where "inactive" items are still visible on screen.
    The previous behaviour only proved useful for transitioning between items when
    only a single item is displayed pre/post-transition.
Commits on Sep 18, 2012
  1. @0liver

    added possibility to enclose tooltip element inside trigger element (…

    0liver authored Oliver Heard committed
    …e.g. for table cells), incl. test
  2. @brewt

    Fix for clicking on the next/prev month when it's been disabled via v…

    brewt authored Oliver Heard committed
    …isibility: hidden closes the calendar - target is the root node instead of the button.
  3. @ewheeler

    check each tooltip for existence, fixes issue 349

    ewheeler authored Oliver Heard committed
    rather than checking if any tooltips already exist.
    this way tooltips on some elements that are reloaded via
    ajax calls will continue working. the previous code would
    assume all tooltips still exist if *any* of the tooltips still
    exist -- even if some of them no longer exist. now, part of a
    page may be changed and can have new tooltips created instead
    of only the ones for elements that did not change.
    
    resolves: jquerytools#349
    
    Signed-off-by: Adam Mckaig <adam.mckaig@gmail.com>
  4. @duclet

    #480: Fixing readonly bug

    duclet authored Oliver Heard committed
  5. @lagrz

    When you have a mask currently open and close and need another opened…

    lagrz authored Oliver Heard committed
    … right after. Enables chaining using the onClose callback method
  6. @duclet

    Issue #563: Fixed

    duclet authored Oliver Heard committed
  7. Corrected whitespace in scrollable.js

    Oliver Heard authored
    I used spaces instead of tabs in my last commit, this fixes it.
Commits on Sep 24, 2012
This page is out of date. Refresh to see the latest.
Showing with 19 additions and 16 deletions.
  1. +12 −11 src/scrollable/scrollable.js
  2. +7 −5 src/toolbox/toolbox.mousewheel.js
View
23 src/scrollable/scrollable.js
@@ -19,6 +19,7 @@
conf: {
activeClass: 'active',
circular: false,
+ clones: 1,
clonedClass: 'cloned',
disabledClass: 'disabled',
easing: 'swing',
@@ -201,10 +202,11 @@
// circular loop
if (conf.circular) {
-
- var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap),
- cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap);
-
+ var items = self.getItems(),
+ cloned1 = items.slice(-conf.clones).clone(),
+ cloned2 = items.slice(0, conf.clones).clone();
+ cloned1.prependTo(itemWrap);
+ cloned2.appendTo(itemWrap);
cloned1.add(cloned2).addClass(conf.clonedClass);
self.onBeforeSeek(function(e, i, time) {
@@ -216,17 +218,16 @@
2. seek to correct position with 0 speed
*/
if (i == -1) {
- self.seekTo(cloned1, time, function() {
- self.end(0);
- });
+ self.seekTo(cloned1.last(), time, function() {
+ self.end(0);
+ });
return e.preventDefault();
} else if (i == self.getSize()) {
- self.seekTo(cloned2, time, function() {
- self.begin(0);
- });
+ self.seekTo(cloned2.first(), time, function() {
+ self.begin(0);
+ });
}
-
});
// seek over the cloned item
View
12 src/toolbox/toolbox.mousewheel.js
@@ -35,25 +35,27 @@
// shared event handler
function wheelHandler( event ) {
-
switch ( event.type ) {
// FF2 has incorrect event positions
case "mousemove":
- return $.extend( event.data, { // store the correct properties
+ // store the correct properties
+ return $.extend( event.originalEvent.data, {
clientX: event.clientX, clientY: event.clientY,
pageX: event.pageX, pageY: event.pageY
});
// firefox
case "DOMMouseScroll":
- $.extend( event, event.data ); // fix event properties in FF2
- event.delta = -event.detail / 3; // normalize delta
+ // fix event properties in FF2
+ $.extend( event.originalEvent, event.originalEvent.data );
+ // normalize delta
+ event.delta = -event.originalEvent.detail / 3;
break;
// IE, opera, safari
case "mousewheel":
- event.delta = event.wheelDelta / 120;
+ event.delta = event.originalEvent.wheelDelta / 120;
break;
}
Something went wrong with that request. Please try again.