Skip to content

Instantly share code, notes, and snippets.

(function( $ ){
$.fn.pushTop = function() {
return this.each(function() {
var $this = $(this);
top_z_index = 0;
$('*').each(function() {
var this_z_index = $(this).css('z-index');
if (this_z_index != "auto" && this_z_index > top_z_index) {
top_z_index = this_z_index;
}
function setFacebookLike() {
$('html').attr("xmlns:og","http://www.facebook.com/2008/fbml").attr("xmlns:fb","http://www.facebook.com/2008/fbml");
// Remove previously created FB like elements -- if they exist -- so they can be re-added after AJAX pagination
$('.fb-recommend').remove();
$('#fb-root').empty();
// Build and inject Like button
$('ul.posts a').each(function() {
var fb_url = location.href.split('/')[0] + '//' + location.href.split('/')[2] + $(this).attr('href'),
// Build and inject Like button
$('ul.posts a').each(function() {
var fb_url = location.href.split('/')[0] + '//' + location.href.split('/')[2] + $(this).attr('href'),
fb_like = '<div class="fb_recommend"><fb:like href="'+fb_url+'" layout="standard" show_faces="false" action="recommend" colorscheme="light"></fb:like></div>';
$(this).parent().next().after(fb_like);
});
var fb_like = '<div class="fb_recommend"><fb:like href="'+fb_url+'" layout="standard" show_faces="false" action="recommend" colorscheme="light"></fb:like></div>';
$(this).parent().next().after(fb_like);
// Load in FB javascript SDK
$('body').append('<div id="fb-root"></div>');
window.fbAsyncInit = function() {
FB.init({appId: '146516048706850', status: true, cookie: true, xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
$('aside.filter li').each(function() {
var this_class = $(this).attr('class'),
people_count = $('div#crew_list > div.'+this_class+' div.user').length,
percentage = ((((people_count / $('div#crew_list div.user').length)*100)).toString()+'%');
$(this)
.css('width',percentage)
.data('width',percentage)
.find('span')
.append(people_count);
});
// following code is simplified from actual implementation.
$('#portfolios .gallery').live('click',function(e) {
VS.lightbox.init();
var folio_path = '/portfolio/'+$(this).data('id');
$.ajax({
type: 'GET',
url: folio_path,
success: function(data) {
VS.lightbox.addContent(data);
// following code is simplified from actual implementation.
$('#portfolios .gallery').live('click',function(e) {
VS.lightbox.init();
var folio_path = '/portfolio/'+$(this).data('id');
$.ajax({
type: 'GET',
url: folio_path,
success: function(data) {
VS.lightbox.addContent(data);
<li> item 1 </li>
<li> ~ </li>
<li> item 2 </li>
<li> ~ </li>