Trevor Davis « visit
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Trevor Davis - http://trevordavis.net
$(document).ready(function() {
//Remove twitter message if it's empty
if(jQuery.trim($('div#twitterContainer').text()) == 'No public Twitter messages.') {
$('div#twitterContainer').html('<a href="http://twitter.com/davist11" class="twitter-link">Follow Me on Twitter</a>');
//$('body').addClass('noTwitter');
}
//Recent Work Section
$('div#recentWorkContainer').after('<a href="#" id="recentWorkPrev" title="Previous">Previous</a><a href="#" id="recentWorkNext" title="Next">Next</a>');
var currentWorkPosition = 0;
var goTo = 0;
var bodyId = $('body').attr('id');
if(bodyId == 'home') {
var scrollAmount = 480;
} else {
var scrollAmount = 360;
}
$('a#recentWorkPrev, a#recentWorkNext').click(function() {
$(this).css('outline','none');
var action = $(this).text();
if(action == 'Previous') {
if(currentWorkPosition == 0) {
if(scrollAmount == 480) {
currentWorkPosition = 960;
} else {
currentWorkPosition = 1080;
}
} else {
currentWorkPosition = currentWorkPosition - scrollAmount;
}
} else if( action == 'Next') {
if((scrollAmount == 480 && currentWorkPosition == 960) || (scrollAmount == 360 && currentWorkPosition == 1080)) {
currentWorkPosition = 0;
} else {
currentWorkPosition = currentWorkPosition + scrollAmount;
}
}
goTo = '-'+currentWorkPosition+'px';
$('ul#recentWorkDisplay').animate({'left':goTo}, 1500);
return false;
});
//Recent posts Tabs
$('ul#tabNav a').click(function() {
$(this).css('outline','none');
var curChildIndex = $(this).parent().prevAll().length + 1;
$(this).parent().parent().children('.current').removeClass('current');
$(this).parent().addClass('current');
$(this).parent().parent().next('.tabContainer').children('.current').slideUp('fast',function() {
$(this).removeClass('current');
$(this).parent().children('div:nth-child('+curChildIndex+')').slideDown('normal',function() {
$(this).addClass('current');
});
});
return false;
});
//RSS Feeds
$('a#rssHeader').click(function() {
$(this).css('outline','none');
$(this).siblings('ul').slideToggle()
return false;
});
//Search form
if($('form#searchForm input#s').val() == '') {
$('form#searchForm input#s').val($('form#searchForm input#s').attr('title'));
}
$('form#searchForm input#s').focus(function() {
if($(this).val() == $(this).attr('title')) {
$(this).val('');
}
});
$('form#searchForm input#s').blur(function() {
if($(this).val() == '') {
$(this).val($(this).attr('title'));
}
});
//Subpage accordian
$('div.recent h3 a').click(function() {
$(this).css('outline','none');
if($(this).parent().parent().hasClass('current')) {
$(this).parent().siblings('ul').slideUp('slow',function() {
$(this).parent().removeClass('current');
$.scrollTo('#recentPosts',1000);
});
} else {
$('div.recent.current ul').slideUp('slow',function() {
$(this).parent().removeClass('current');
});
$(this).parent().siblings('ul').slideToggle('slow',function() {
$(this).parent().toggleClass('current');
});
$.scrollTo('#recentPosts',1000);
}
return false;
});
$('div#secondaryContent div.module.asides ul li p:last-child').addClass('last');
/*
//Add in Comments and Trackbacks Nav
var numComments = $("ol#commentListing > li[class!='trackback']").length;
var numTrackbacks = $('ol#commentListing > li.trackback').length;
if(numComments > 0 || numTrackbacks > 0) {
$('div#comments').prepend('<ul id="commentsNav"></ul>');
if(numComments > 0) {
$('ul#commentsNav').append('<li id="numComments" class="current"><a href="#comments">'+ numComments +' Comments</a></li>');
}
if(numTrackbacks > 0) {
$('ol#commentListing').after('<ol class="commentlist" id="trackbackListing"></ol>');
$('ol#commentListing > li.trackback').each(function() {
$(this).clone().appendTo('ol#trackbackListing');
$(this).fadeOut().remove();
});
$('ul#commentsNav').append('<li id="numTrackbacks"><a href="#trackbacks">'+ numTrackbacks +' Trackbacks</a></li>');
if(numComments == 0) {
$('ul#commentsNav li#numTrackbacks, ol#trackbackListing').addClass('current');
}
}
}*/
//Comments & Trackbacks Tabs
$('div#comments ul#commentsNav a').click(function() {
var commentsNavId = $(this).parent().attr('id');
if(!$(this).parent().hasClass('current')) {
$('div#comments ul#commentsNav li.current').removeClass('current');
$(this).parent().addClass('current');
if(commentsNavId == 'numComments') {
$('div#comments ol#trackbackListing').slideUp('slow', function() {
$('div#comments ol#commentListing').slideDown('fast');
});
} else if(commentsNavId == 'numTrackbacks') {
$('div#comments ol#commentListing').slideUp('slow', function() {
$('div#comments ol#trackbackListing').slideDown('fast');
});
}
$.scrollTo('#commentsNav',1000);
}
return false;
});
//Comments reply
$('ol#commentListing li').each(function() {
$(this).children('.commentorInfo').append('<li class="reply"><a href="#reply">Reply »</a>');
$(this).find('li.reply a').click(function() {
var commentor = $(this).parent().siblings('.commentor').text();
var currentComment = $(this).parent().parent().parent().attr('id');
var commentVal = $('form#commentform textarea#comment').val();
var newVal = '@<a href="#'+currentComment+'">'+commentor+'</a>-'+"\n";
if(commentVal === '') {
$('form#commentform textarea#comment').val(newVal);
} else {
$('form#commentform textarea#comment').val(newVal+commentVal);
}
$.scrollTo('form#commentform',1000);
$('form#commentform textarea#comment').focus();
return false;
});
});
//Flickr alt class
$('div#flickr ul li:nth-child(4n)').addClass('alt');
$('#flickr ul a').each(function() {
var imgSrc = $(this).children().attr('src');
$(this).attr('href',imgSrc.replace('_s.jpg','.jpg'));
});
//$('a[rel*=lightbox]').slimbox();
//Grid link
$('a.viewGrid').click(function() {
$('body').prepend('<div id="grid" style="display: none; height: 0;"></div>');
if($.browser.msie && $.browser.version <= 6.0) {
var windowHeight = $(document).height();
windowHeight = windowHeight + 'px';
} else {
var windowHeight = '100%';
}
$('div#grid').animate({ height: windowHeight}, 2500);
$('div#grid').click(function() {
$(this).animate({ height: "0"}, 1000, function() {
$(this).remove();
});
});
return false;
});
//Tooltips
var title = '';
$('ul#portfolio a').hover(function() {
title = $(this).attr('title');
$(this).attr('title','');
$(this).children('img').attr('alt','');
var elOff = $(this).offset();
$('<div id="tooltip" />')
.appendTo('body')
.text(title)
.hide()
.css({top: elOff.top + 10,left: elOff.left + 100})
.fadeIn('normal');
}, function() {
$(this).attr('title',title);
$('#tooltip').remove();
});
});
Syndicate
Categories
Statistics
There are 330 Sites with 745 Links of Interest in 18 Categories. The latest Site was added 4 months ago.
About
This is a project by Sebastian Senf, for his part jQuery user and lover too. Follow me.