HighDots Forums  

Help with jQuery portfolio code

jQuery jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.


Discuss Help with jQuery portfolio code in the jQuery forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
riddle.w
 
Posts: n/a

Default Help with jQuery portfolio code - 11-07-2009 , 01:56 PM






OK So I'm trying to get my portfolio up and working. The problem I'm
having right now is some glitchy code that I'm using for the porfolio.
Right now it displays 9 thumbnails inside of a container. Then once
you click on a thumbnail, they all fade out to a loading bar. Once the
portfolio and picture are loaded (via json), the loading bar fades out
and the portfolio stuff fades in.

The problem is that since the website's height is set to auto, when
everything fades out to the loading bar, the website animates to be
really small. I don't want this. I want it to stay the same height it
was when it was clicked, and then once everythings loaded it animates
to get bigger to show all of the information. No height change when
the loading bar appears.

Here's what I've been using:
$(function() {
var barLeft = (909 - 220) / 2,
barTop = (460 - 19) / 2;

$('.portfolio-piece').click(function() {
$('.portfolio-piece').animate({opacity: 0}, 500).children().animate
({opacity: 0}, 500, function() {
$('#main-portfolio').html('<div id="portfolio-loading"><img
src="images/ajax-loader.gif" alt="Loading" /></div>');
$('#portfolio-loading').css({opacity: 0, top: barTop, left:
barLeft}).animate({opacity: 1}, 500);

$.getJSON('json.txt', null, function(data) {
$('#portfolio-loading').animate({opacity: 0}, 500, function() {

$('#main-portfolio').html('<div id="piece-image"><img src="' +
data.image + '" /><table><tbody><tr><th>Name</th><td>' + data.name +
'</td></tr><th>Technologies</th><td>' + data.technologies + '</td></
tr><tr><th>About</th><td>' + data.about + '</td></tr></tbody></table></
div>').css("opacity", 0).animate({opacity: 1}, 250);

$('#main-portfolio').animate({height: targetHeight}, 250);
});
});

});


return false;
});
});

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.