Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-20-2011, 04:27 PM   PM User | #1
markdunbavan
New to the CF scene

 
Join Date: Sep 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
markdunbavan is an unknown quantity at this point
jquery .animate problems

Hello.

I am trying to create multiple functions in jquery that slide pages up and down into view and then they load an external html page into them like so;

Code:
www.markdunbavan.co.uk/dev/OS
The problem I am having is creating the transitions that are for each link to work independently yet have the same effect. I see there are 2 options; 1 to go with what I have now and figure out how to get around it or 2 use the jquery switchClass to create the transitions but then how would that manifest the .load function in it. Here is the jquery I use;

Code:
$(function() {
    $('.log').ajaxStart(function() {
        $(this).text('');
    });
    $('#contactbutton').click(function() {
        loadContent('.result', 'contact.html', '#contactcontent');
		unloadaboutContent('.result2', 'about.html', '#aboutpage');
    });
    
    $('.log2').ajaxStart(function() {
        $(this).text('');
    });
    $('#aboutscrollbutton').click(function() {
        loadContent('.result2', 'about.html', '#aboutpage');
		unloadcontactContent('.result', 'contact.html', '#contactcontent');
    });
});

function loadContent(result, source, content) {
    $(result).load(source);
    $(content).stop().delay(100).fadeIn(1900).css("marginTop","500px").animate(
        {overflow: 'hidden', opacity: 1.0, marginTop: '-500px', queue: false},
        {duration: 1000, specialEasing: {top: 'easeInOutQuad'}});
    $('#folio').animate(
        {top: '-900px', opacity: 0.2, overflow: 'hidden'},
        {duration: 1000, specialEasing: {top: 'easeInOutQuad'}});
}
function unloadaboutContent(content) {
    $(content).delay('normal').animate
		(
        {overflow: 'hidden', opacity: 1.0},
        {duration: 1000, specialEasing: {top: 'easeInOutQuad'}}
		);
		$(content).slideUp('normal',loadContent);
}

function unloadcontactContent(content) {
    $(content).delay('normal').animate
		(
        {overflow: 'hidden', opacity: 1.0},
        {duration: 1000, specialEasing: {top: 'easeInOutQuad'}}
		);
		$(content)
		.animate({top: '-200'})
		.slideUp(500,loadContent);
}
function aboutcompletepagetransition(){
	{queue: false}
	$('.result2', 'about.html', '#aboutpage').remove();
			if(loadContent && unloadaboutContent) {
    
		}else{
    // "stop"
    	return;
	}
	
}
If anyone would know a quicker way for doing this that would be great.

Thanks

Mark
markdunbavan is offline   Reply With Quote
Reply

Bookmarks

Tags
.animate, functions, jquery, jquery ui

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

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

Forum Jump


All times are GMT +1. The time now is 04:20 PM.


Advertisement
Log in to turn off these ads.