Advertisement
kentopolis

Java Script for slider

May 30th, 2011
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. // HOME FEATURED LIST ROTATOR
  2. $j(document).ready(function() {
  3.  
  4. //Show Banner
  5. $j(".main_image .desc").show(); //Show Banner
  6. $j(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity
  7.  
  8. //Click and Hover events for thumbnail list
  9. $j(".image_thumb ul li:first").addClass('active');
  10. $j(".image_thumb ul li").click(function(){
  11. //Set Variables
  12. var imgAlt = $j(this).find('img').attr("alt"); //Get Alt Tag of Image
  13. var imgTitle = $j(this).find('a').attr("href"); //Get Main Image URL
  14. var imgDesc = $j(this).find('.block').html(); //Get HTML of block
  15. var imgDescHeight = $j(".main_image").find('.block').height(); //Calculate height of block
  16.  
  17. if ($j(this).is(".active")) { //If it's already active, then...
  18. return false; // Don't click through
  19. } else {
  20. //Animate the Teaser
  21. $j(".main_image img").animate({ opacity: 0}, 250 );
  22. $j(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
  23. $j(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 );
  24. $j(".main_image img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
  25. });
  26. }
  27.  
  28. $j(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
  29. $j(this).addClass('active'); //add class of 'active' on this list only
  30. return false;
  31.  
  32. }) .hover(function(){
  33. $j(this).addClass('hover');
  34. }, function() {
  35. $j(this).removeClass('hover');
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement