Skip to content

Instantly share code, notes, and snippets.

@theskillwithin
Created April 5, 2016 22:47
Show Gist options
  • Save theskillwithin/8b9ee54601d770af012d412b573c4543 to your computer and use it in GitHub Desktop.
Save theskillwithin/8b9ee54601d770af012d412b573c4543 to your computer and use it in GitHub Desktop.
bleh example
$(document).ready(function() {
var hrefId = [];
$('#fixed-nav li a').each(function() {
var that = $(this);
hrefId.push(that.attr('href'));
});
$('#fixed-nav a[href$=#home]').css('color','red');
$('.topbarbg').css('opacity', '1');
var current;
$(document).scroll(function() {
current = $.map(hrefId, function(a) {
var height = $(a).height();
var a = $(a).offset().top - $(window).scrollTop() + height;
if (a >= 0) {
return a;
} else {
return 999999;
}
});
function indexOfSmallest(b) {
return b.indexOf(Math.min.apply(Math, b));
}
var page = indexOfSmallest(current);
page = hrefId[page];
$('#fixed-nav li a').attr('style','');
$('#fixed-nav a[href$=' + page + ']').css('color','red');
var scrolltop = $(window).scrollTop();
if(scrolltop > 763) {
$('.topbarbg').css('opacity', '.94');
} else {
$('.topbarbg').css('opacity', '1');
}
});
$('.scroll-link').on('click',function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top - 80
}, 1000, 'swing', function () {
window.location.hash = target;
});
});
});
// $(document).ready(function() {
// $("#basicuse").jflickrfeed({
// limit: 12,
// qstrings: {
// id: "32815517@N00"
// },
// itemTemplate: '<li><a rel="photostream" class="fancybox" title="{{title}}" href="{{image_b}}"><img src="{{image_s}}" alt="{{author}}" /></a></li>'
// })
// });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment