Learn how to use jQuery at the Blog

Afflecks Palace « visit

  • Added 8 months ago
  • 70 Lines of Code shown
  • 3 Links of Interest
http://afflecks.com
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 Afflecks Palace - http://afflecks.com

$(document).ready(function(){

    // How to find us slider
    $(".find-us-slide").click(function(){
		$("#HowToFindUs").slideToggle("slow");
        return false;
	});
    
    
    // Initialise Flickr thumbs
    $('.flickr-thumbs a').each(function() {
		var imgSrc = $(this).children().attr('src');
		$(this).attr('href',imgSrc.replace('_s.jpg','.jpg'))
	});
    
    $('.flickr-thumbs a').lightBox({fixedNavigation:true});

    // Show more blog content
	$(".blog-posts .post-entry-content").each(function(){
		if($(this).children('p').size() > 1){
			$(this).children('p:gt(1)').hide();
			$(this).children('p:eq(1)').after("<p><a class=\"show-hide\" href='#'>Read more...</a></p>");
		}
	});
	
	$('.post-entry-content a.show-hide').click(function() {
		$(this).parent().nextAll('p').show();
        $(this).parent('p').hide();
		return false;
	});

    // paginate flickrRss (shows 30 pics per page)
    var numpics = $('.flickr-thumbs li').size();
    var numpages = Math.ceil((numpics/30));
    
    if(numpics > 30){
		$('.flickr-thumbs-nav').show();
		$('.flickr-thumbs li:gt(29)').hide();
		$('.flickr-thumbs-nav a').click(function(){

			var thumbpage = eval(this.rel);
			$('.flickr-thumbs li').hide();
			$('.flickr-thumbs div.spinner').show();
			$('.flickr-thumbs').animate({opacity: 1.0}, 200,'',function(){
				$('.flickr-thumbs li:lt('+(thumbpage*30)+'):gt('+(((thumbpage-1)*30)-1)+')').fadeIn();
				$('.flickr-thumbs div.spinner').hide();
			});

			// update link rel attr values
			$('.flickr-thumbs-nav li.next-link a').attr('rel',thumbpage+1);
			$('.flickr-thumbs-nav li.prev-link a').attr('rel',thumbpage-1);

			// show hide prev/next links
			if(thumbpage > (numpages-1))
				$('.flickr-thumbs-nav').removeClass('hide-previous').addClass('hide-next');
			else if(thumbpage == 1)
				$('.flickr-thumbs-nav').addClass('hide-previous').removeClass('hide-next');
			else
				$('.flickr-thumbs-nav').removeClass('hide-next').removeClass('hide-previous');

			return false;
		});
    
    }
    
    $('#SelectStore select').change(function(){
       $('#SelectStore').submit();
    });
    
});