View Single Post
Old 11-07-2012, 06:02 PM   PM User | #1
MissStress
New to the CF scene

 
Join Date: Nov 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
MissStress is an unknown quantity at this point
Changing image slider to fade from rotate.

Hi folks,

Novice js user here. I'm building a site using a Drupal theme ("Business") and it comes with an image slider which currently swaps images by rotating them. I'd like to have the images fade in/out and while usually I can google/mash my way though the script and figure out the changes I'd like to make, things I have tried so far have not worked in this instance.

There is a file called sliding_effect.js and within this file is the code I suspect I have to change but not sure a) what to change/delete/comment out and b) if there are any other files I need to modify. I am unable to post a link to the site as it's not publicly available yet but will post the suspect code below. Any help is greatly appreciated!

Code:
	//Paging + Slider Function
	rotate = function(){	
	    var triggerID = $active.attr("rel") - 1; //Get number of times to slide
	    var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide
	
	    $(".paging a").removeClass('active'); //Remove all active class
	    $active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
	    
		$(".desc").stop(true,true).slideUp('slow');
		
		$(".desc").eq( $('.paging a.active').attr("rel") - 1 ).slideDown("slow"); 
		
	    //Slider Animation
	    $(".image_reel").animate({ 
	        left: -image_reelPosition
	    }, 500 ); 
	
		
	}; 

	//Rotation + Timing Event
	rotateSwitch = function(){	
	$(".desc").eq( $('.paging a.active').attr("rel") - 1 ).slideDown("slow");	
	    play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
	        $active = $('.paging a.active').next();
	        if ( $active.length === 0) { //If paging reaches the end...
	            $active = $('.paging a:first'); //go back to first
	        }
	        rotate(); //Trigger the paging and slider function
	    }, 5000); //Timer speed in milliseconds (3 seconds)	
	
	};
	
	rotateSwitch(); //Run function on launch
MissStress is offline   Reply With Quote