aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-07 17:28:35 +0000
committerpete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-07 17:28:35 +0000
commit89fa2c232ea2a806a70f96d0f28fd6318163227c (patch)
treecfa15224d35a4d9a507c10c3257ff63ac8a36f49
parent5db2402d1eb38e012081509be292bcd1fcef164d (diff)
downloadelgg-89fa2c232ea2a806a70f96d0f28fd6318163227c.tar.gz
elgg-89fa2c232ea2a806a70f96d0f28fd6318163227c.tar.bz2
updated, cleaned-up, credited, and tweaked friends picker
git-svn-id: https://code.elgg.org/elgg/trunk@1777 36083f99-b078-4883-b0ff-0f9b5a30f544
-rwxr-xr-xjavascript/friendsPickerv1.js41
1 files changed, 15 insertions, 26 deletions
diff --git a/javascript/friendsPickerv1.js b/javascript/friendsPickerv1.js
index e41a9150c..a8f3e1abf 100755
--- a/javascript/friendsPickerv1.js
+++ b/javascript/friendsPickerv1.js
@@ -1,11 +1,11 @@
-// elgg friendsPicker jquery plugin
-
-// create a separate namespace for each picker - so we can have multiple pickers per page
-var j = 0;
+/*
+ elgg friendsPicker plugin
+
+ adapted from Niall Doherty's excellent Coda-Slider - http://www.ndoherty.com/coda-slider
+*/
jQuery.fn.friendsPicker = function(iterator) {
- j = iterator;
var settings;
settings = $.extend({ easeFunc: "easeOutExpo", easeTime: 1000, toolTip: false }, settings);
@@ -31,19 +31,19 @@ jQuery.fn.friendsPicker = function(iterator) {
container.each(function(i) {
// generate Left and Right arrows
- $(this).before("<div class='friendsPickerNavigationL' id='friendsPickerNavigationL" + j + "'><a href='#'>Left</a><\/div>");
- $(this).after("<div class='friendsPickerNavigationR' id='friendsPickerNavigationR" + j + "'><a href='#'>Right</a><\/div>");
+ $(this).before("<div class='friendsPickerNavigationL' id='friendsPickerNavigationL" + iterator + "'><a href='#'>Left</a><\/div>");
+ $(this).after("<div class='friendsPickerNavigationR' id='friendsPickerNavigationR" + iterator + "'><a href='#'>Right</a><\/div>");
// generate a-z tabs
- $(this).before("<div class='friendsPickerNavigation' id='friendsPickerNavigation" + j + "'><ul><\/ul><\/div>");
+ $(this).before("<div class='friendsPickerNavigation' id='friendsPickerNavigation" + iterator + "'><ul><\/ul><\/div>");
$(this).find("div.panel").each(function(individualTabItemNumber) {
- $("div#friendsPickerNavigation" + j + " ul").append("<li class='tab" + (individualTabItemNumber+1) + "'><a href='#" + (individualTabItemNumber+1) + "'>" + $(this).attr("title") + "<\/a><\/li>");
+ $("div#friendsPickerNavigation" + iterator + " ul").append("<li class='tab" + (individualTabItemNumber+1) + "'><a href='#" + (individualTabItemNumber+1) + "'>" + $(this).attr("title") + "<\/a><\/li>");
});
// tabs navigation
- $("div#friendsPickerNavigation" + j + " a").each(function(individualTabItemNumber) {
+ $("div#friendsPickerNavigation" + iterator + " a").each(function(individualTabItemNumber) {
// calc friendsPickerNavigationWidth by summing width of each li
friendsPickerNavigationWidth += $(this).parent().width();
// set-up individual tab clicks
@@ -56,7 +56,7 @@ jQuery.fn.friendsPicker = function(iterator) {
});
// Right arow click function
- $("div#friendsPickerNavigationR" + j + " a").click(function() {
+ $("div#friendsPickerNavigationR" + iterator + " a").click(function() {
if (currentPanel == panelCount) {
var distanceToMoveFriendsPicker_container = 0;
currentPanel = 1;
@@ -71,7 +71,7 @@ jQuery.fn.friendsPicker = function(iterator) {
});
// Left arrow click function
- $("div#friendsPickerNavigationL" + j + " a").click(function() {
+ $("div#friendsPickerNavigationL" + iterator + " a").click(function() {
if (currentPanel == 1) {
var distanceToMoveFriendsPicker_container = - (panelWidth*(panelCount - 1));
currentPanel = panelCount;
@@ -86,25 +86,14 @@ jQuery.fn.friendsPicker = function(iterator) {
});
// apply 'current' class to currently selected tab link
- $("div#friendsPickerNavigation" + j + " a:eq(0)").addClass("current");
+ $("div#friendsPickerNavigation" + iterator + " a:eq(0)").addClass("current");
});
- // manually add class to corresponding tab for panels that have content - needs to be automated eventually
- //$("div#friendsPickerNavigation" + j + " li.tab3 a").addClass("tabHasContent");
- //$("div#friendsPickerNavigation" + j + " li.tab6 a").addClass("tabHasContent");
- //$("div#friendsPickerNavigation" + j + " li.tab9 a").addClass("tabHasContent");
- //$("div#friendsPickerNavigation" + j + " li.tab17 a").addClass("tabHasContent");
- //$("div#friendsPickerNavigation" + j + " li.tab22 a").addClass("tabHasContent");
-
- // generate link to 'all friends in collection' - removed for now
- //$("div#friendsPickerNavigation" + j).append("<div class='friendsPickerNavigationAll'><a href='#' >Collection members<\/a></div><br />");
- $("div#friendsPickerNavigation" + j).append("<br />");
-
- //$("div#friendsPickerNavigation" + j).hide();
+ $("div#friendsPickerNavigation" + iterator).append("<br />");
+ //$("div#friendsPickerNavigation" + iterator).hide();
- //j++;
});
};