Advertisement
Guest User

portfolio

a guest
Aug 11th, 2011
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. jQuery(document).ready(function($){
  2.  
  3. /*-----------------------------------------------------------------------------------*/
  4. /* PrettyPhoto (lightbox) */
  5. /*-----------------------------------------------------------------------------------*/
  6.  
  7. /* $("a[rel^='lightbox']").prettyPhoto(); */
  8.  
  9. /*-----------------------------------------------------------------------------------*/
  10. /* Portfolio thumbnail hover effect */
  11. /*-----------------------------------------------------------------------------------*/
  12.  
  13. jQuery('#portfolio img').mouseover(function() {
  14. jQuery(this).stop().fadeTo(300, 0.5);
  15. });
  16. jQuery('#portfolio img').mouseout(function() {
  17. jQuery(this).stop().fadeTo(400, 1.0);
  18. });
  19.  
  20. /*-----------------------------------------------------------------------------------*/
  21. /* Portfolio tag toggle on page load, based on hash in URL */
  22. /*-----------------------------------------------------------------------------------*/
  23.  
  24. if ( jQuery( '.port-cat a' ).length ) {
  25. var currentHash = '';
  26. currentHash = window.location.hash;
  27.  
  28. // If we have a hash, begin the logic.
  29. if ( currentHash != '' ) {
  30. currentHash = currentHash.replace( '#', '' );
  31.  
  32. if ( jQuery( '#portfolio .' + currentHash ).length ) {
  33.  
  34. // Select the appropriate item in the category menu.
  35. jQuery( '.port-cat a.current' ).removeClass( 'current' );
  36. jQuery( '.port-cat a[rel="' + currentHash + '"]' ).addClass( 'current' );
  37.  
  38. // Show only the items we want to show.
  39. jQuery( '#portfolio .post' ).hide();
  40. jQuery( '#portfolio .' + currentHash ).fadeIn( 400 );
  41.  
  42. }
  43. }
  44.  
  45. }
  46.  
  47. /*-----------------------------------------------------------------------------------*/
  48. /* Portfolio tag sorting */
  49. /*-----------------------------------------------------------------------------------*/
  50.  
  51. jQuery('.port-cat a').click(function(evt){
  52. var clicked_cat = jQuery(this).attr('rel');
  53.  
  54. jQuery( '.port-cat a.current' ).removeClass( 'current' );
  55. jQuery( this ).addClass( 'current' );
  56.  
  57. if(clicked_cat == 'all'){
  58. jQuery('#portfolio .post').hide().fadeIn(200);
  59. } else {
  60. jQuery('#portfolio .post').hide();
  61. jQuery('#portfolio .' + clicked_cat).fadeIn(400);
  62. }
  63. //eq_heights();
  64. evt.preventDefault();
  65. })
  66.  
  67. // Thanks @johnturner, I owe you a beer!
  68. var postMaxHeight = 0;
  69. jQuery("#portfolio .post").each(function (i) {
  70. var elHeight = jQuery(this).height();
  71. if(parseInt(elHeight) > postMaxHeight){
  72. postMaxHeight = parseInt(elHeight);
  73. }
  74. });
  75. jQuery("#portfolio .post").each(function (i) {
  76. jQuery(this).css('height',postMaxHeight+'px');
  77. });
  78.  
  79. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement