www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] JavaScript fadeshow with pagination

  1. #1
    Join Date
    Nov 2009
    Posts
    6

    resolved [RESOLVED] JavaScript fadeshow with pagination

    I'm sorry! My english isn't good.

    I'm beginner in JavaScript, and jQuery.
    I have made a fadeshow. It works perfectly, but i'd like to make pagination for this slideshow and I don't know, how sould I solve it.
    I don't want to generate the pagination with javascipt. Because I'm going to generate the pagination with php, because the required data (menu name, menu id ect) is in database.
    I have got menu links with these ID-s: link_1, link_2, link_3 ect.

    Here is the code:

    Code:
    <!--
    $(document).ready(function(){
    
    	var windowWidth = $(window).width();
    	var windowHeight = $(window).height();
    	// slideshow begin
    	var slideTime = 5000;	// slide time param
    	var fadeTime = 1000;	// fade time param
    	
    	titlePosition();
    	slide();
    
    	function slide(){
    		setTimeout(slideshow, slideTime);
    		$('.active_image').parent('div').fadeIn(fadeTime);
    	}
    
    	function slideshow(){
    
    		actualImage = $('.active_image').parent().attr('id');
    		actualImageNumber = actualImage.split('_');
    		nextImageNumber = parseInt(actualImageNumber[1]) + 1;
    		nextImage = actualImageNumber[0] + '_' + nextImageNumber;
    		$('.active_image').parent('div').fadeOut(fadeTime);
    		$('#slider img').removeAttr('class');
    
    		if ($('#'+nextImage).length > 0){
    			$('#'+nextImage).children('img').addClass('active_image');
    		}
    
    		else{
    			$('#slide_1').children('img').addClass('active_image');
    		}
    
    		slide();
    
    	}
    	//slideshow end
    	
    	$('nav a').live('click', function(){
    		url = 'includes/'+$(this).attr('href');
    		if (url == 'includes/index.php'){
    			url = 'includes/fooldal.php';
    		}
    		
    		$('nav li').removeClass('nav_active');
    		$(this).parent().parent().addClass('nav_active');
    		
    		if ($('#loading').length<=0){
    			$('body').append('<div id="loading"><img src="images/pictures/loading.gif" alt="Betöltés" title="Betöltés"></div>');
    			$('#loading').css('height', windowHeight);
    			$('#loading img').css('margin-top', windowHeight/2-32);
    			$('#loading img').css('margin-left', windowWidth/2-32);
    		}
    		
    		$('#article').load(url), function(){
    		};
    		return false;
    	});
    
    	$(window).resize(function() {
    		
    		titlePosition();
    	
    		var windowWidth = $(window).width();
    		var windowHeight = $(window).height();
    	
    		$('#loading').css('height', windowHeight);
    		$('#loading img').css('margin-top', windowHeight/2-32);
    		$('#loading img').css('margin-left', windowWidth/2-32);
    	
    	});
    	
    	function titlePosition(){
    		$('#title').prependTo($('article'));
    	}
    });
    -->
    On my website the menu links are after the fadeshow. I want to do, if I click on a menu link the fadeshow jump to the relevant image of the link with fade effect. if I click the link the new content load after the menu in a container div.

    Please help me!

    Thank you
    Kissgy1028

  2. #2
    Join Date
    Nov 2009
    Posts
    6
    I've solved my problem with jQuery delay().

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles