Skip to content

Instantly share code, notes, and snippets.

@thisgeek
Forked from 34tth3r1ch/healthguide.js
Created August 27, 2012 00:27

Revisions

  1. thisgeek revised this gist Aug 27, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion healthguide.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@ jQuery(function() {
    var myApi, verts;

    // Query for sub-navigation elements. Make each vertically
    // scrollable. Save query object as local variable.
    // scrollable. Save query object as local variable to allow
    // methods to be added to the instance.
    verts = $(".vertScrollable").each(function(i, e) {
    $(e).scrollable({
    vertical: true,
  2. thisgeek revised this gist Aug 27, 2012. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions healthguide.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    jQuery(function() {
    var myApi, verts;

    // Query for sub-navigation elements. Make each vertically
    // scrollable. Save query object as local variable.
    verts = $(".vertScrollable").each(function(i, e) {
    $(e).scrollable({
    vertical: true,
    @@ -9,6 +11,7 @@ jQuery(function() {
    });
    });

    // Add resetScroll method to sub-navigation query instance
    verts.resetScroll = function () {
    this.each(function (i, e) {
    $(e).data("scrollable").seekTo(0);
    @@ -18,6 +21,10 @@ jQuery(function() {
    $("#scrollable").scrollable();
    myApi = $("#scrollable").data("scrollable");

    // Iterate through a list of class selectors mapped to indicies.
    // Bind a click event listener to each element returned by the
    // selector query. On click, scroll to the index mapped to the
    // selector and reset the subnavigation scrolling to zero.
    $.each({
    ".nutrition": 0,
    ".fitnessExercise": 1,
  3. thisgeek revised this gist Aug 27, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion healthguide.js
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,9 @@ jQuery(function() {
    });

    verts.resetScroll = function () {
    this.data("scrollable").seekTo(0);
    this.each(function (i, e) {
    $(e).data("scrollable").seekTo(0);
    });
    };

    $("#scrollable").scrollable();
  4. thisgeek revised this gist Aug 27, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion healthguide.js
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ jQuery(function() {
    });

    verts.resetScroll = function () {
    this.seekTo(0);
    this.data("scrollable").seekTo(0);
    };

    $("#scrollable").scrollable();
  5. thisgeek revised this gist Aug 27, 2012. 1 changed file with 27 additions and 32 deletions.
    59 changes: 27 additions & 32 deletions healthguide.js
    Original file line number Diff line number Diff line change
    @@ -1,39 +1,34 @@
    jQuery(document).ready(function() {
    $(".vertScrollable").each(function(i, e) {
    jQuery(function() {
    var myApi, verts;

    verts = $(".vertScrollable").each(function(i, e) {
    $(e).scrollable({
    vertical: true,
    prev: ".healthup",
    next: ".healthdown"
    });
    })
    $("#scrollable").scrollable();
    var myApi = $("#scrollable").data("scrollable");
    $(".nutrition").bind('click', function() {
    myApi.seekTo(0);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".fitnessExercise").bind('click', function() {
    myApi.seekTo(1);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".beautySkincare").bind('click', function() {
    myApi.seekTo(2);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".mindfulness").bind('click', function() {
    myApi.seekTo(3);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".quicktips").bind('click', function() {
    myApi.seekTo(4);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".recipes").bind('click', function() {
    myApi.seekTo(5);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".glossary").bind('click', function() {
    myApi.seekTo(6);
    $(".vertScrollable").data("scrollable").seekTo(0);

    verts.resetScroll = function () {
    this.seekTo(0);
    };

    $("#scrollable").scrollable();
    myApi = $("#scrollable").data("scrollable");

    $.each({
    ".nutrition": 0,
    ".fitnessExercise": 1,
    ".beautySkincare": 2,
    ".mindfulness": 3,
    ".quicktips": 4,
    ".recipes": 5,
    ".glossary": 6
    }, function (selector, index) {
    $(selector).click(function () {
    myApi.seekTo(index);
    verts.resetScroll();
    });
    });
    });

    });
  6. thisgeek revised this gist Aug 27, 2012. 1 changed file with 38 additions and 34 deletions.
    72 changes: 38 additions & 34 deletions healthguide.js
    Original file line number Diff line number Diff line change
    @@ -1,35 +1,39 @@
    jQuery(document).ready(function() {
    $(".vertScrollable").each(function (i, e) {
    $(e).scrollable({vertical:true,prev:".healthup",next:".healthdown"});
    })
    $("#scrollable").scrollable();
    var myApi = $("#scrollable").data("scrollable");
    $(".nutrition").bind('click', function() {
    myApi.seekTo(0);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".fitnessExercise").bind('click', function() {
    myApi.seekTo(1);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".beautySkincare").bind('click', function() {
    myApi.seekTo(2);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".mindfulness").bind('click', function() {
    myApi.seekTo(3);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".quicktips").bind('click', function() {
    myApi.seekTo(4);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".recipes").bind('click', function() {
    myApi.seekTo(5);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".glossary").bind('click', function() {
    myApi.seekTo(6);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    });
    $(".vertScrollable").each(function(i, e) {
    $(e).scrollable({
    vertical: true,
    prev: ".healthup",
    next: ".healthdown"
    });
    })
    $("#scrollable").scrollable();
    var myApi = $("#scrollable").data("scrollable");
    $(".nutrition").bind('click', function() {
    myApi.seekTo(0);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".fitnessExercise").bind('click', function() {
    myApi.seekTo(1);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".beautySkincare").bind('click', function() {
    myApi.seekTo(2);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".mindfulness").bind('click', function() {
    myApi.seekTo(3);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".quicktips").bind('click', function() {
    myApi.seekTo(4);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".recipes").bind('click', function() {
    myApi.seekTo(5);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".glossary").bind('click', function() {
    myApi.seekTo(6);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    });
  7. thisgeek revised this gist Aug 27, 2012. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions healthguide.js
    Original file line number Diff line number Diff line change
    @@ -6,23 +6,30 @@ $("#scrollable").scrollable();
    var myApi = $("#scrollable").data("scrollable");
    $(".nutrition").bind('click', function() {
    myApi.seekTo(0);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".fitnessExercise").bind('click', function() {
    myApi.seekTo(1);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".beautySkincare").bind('click', function() {
    myApi.seekTo(2);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".mindfulness").bind('click', function() {
    myApi.seekTo(3);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".quicktips").bind('click', function() {
    myApi.seekTo(4);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".recipes").bind('click', function() {
    myApi.seekTo(5);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    $(".glossary").bind('click', function() {
    myApi.seekTo(6);
    $(".vertScrollable").data("scrollable").seekTo(0);
    });
    });
  8. thisgeek revised this gist Aug 27, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion healthguide.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ jQuery(document).ready(function() {
    $(".vertScrollable").each(function (i, e) {
    $(e).scrollable({vertical:true,prev:".healthup",next:".healthdown"});
    })
    .scrollable().data("scrollable");
    $("#scrollable").scrollable();
    var myApi = $("#scrollable").data("scrollable");
    $(".nutrition").bind('click', function() {
    myApi.seekTo(0);
  9. thisgeek revised this gist Aug 27, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion healthguide.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@ jQuery(document).ready(function() {
    $(".vertScrollable").each(function (i, e) {
    $(e).scrollable({vertical:true,prev:".healthup",next:".healthdown"});
    })
    var myApi = $("#scrollable").scrollable().data("scrollable");
    .scrollable().data("scrollable");
    var myApi = $("#scrollable").data("scrollable");
    $(".nutrition").bind('click', function() {
    myApi.seekTo(0);
    });
  10. thisgeek revised this gist Aug 27, 2012. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions healthguide.js
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,7 @@ jQuery(document).ready(function() {
    $(".vertScrollable").each(function (i, e) {
    $(e).scrollable({vertical:true,prev:".healthup",next:".healthdown"});
    })
    $("#scrollable").scrollable();
    var myApi = $("#scrollable").data("scrollable");
    var myApi = $("#scrollable").scrollable().data("scrollable");
    $(".nutrition").bind('click', function() {
    myApi.seekTo(0);
    });
  11. thisgeek revised this gist Aug 27, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion healthguide.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    jQuery(document).ready(function() {
    $("#vertScrollable").scrollable({vertical:true,prev:".healthup",next:".healthdown"});
    $(".vertScrollable").each(function (i, e) {
    $(e).scrollable({vertical:true,prev:".healthup",next:".healthdown"});
    })
    $("#scrollable").scrollable();
    var myApi = $("#scrollable").data("scrollable");
    $(".nutrition").bind('click', function() {
  12. @34tth3r1ch 34tth3r1ch created this gist Aug 26, 2012.
    26 changes: 26 additions & 0 deletions healthguide.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    jQuery(document).ready(function() {
    $("#vertScrollable").scrollable({vertical:true,prev:".healthup",next:".healthdown"});
    $("#scrollable").scrollable();
    var myApi = $("#scrollable").data("scrollable");
    $(".nutrition").bind('click', function() {
    myApi.seekTo(0);
    });
    $(".fitnessExercise").bind('click', function() {
    myApi.seekTo(1);
    });
    $(".beautySkincare").bind('click', function() {
    myApi.seekTo(2);
    });
    $(".mindfulness").bind('click', function() {
    myApi.seekTo(3);
    });
    $(".quicktips").bind('click', function() {
    myApi.seekTo(4);
    });
    $(".recipes").bind('click', function() {
    myApi.seekTo(5);
    });
    $(".glossary").bind('click', function() {
    myApi.seekTo(6);
    });
    });