Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3.  
  4. $("ul li").click(function(e) {
  5.  
  6.  
  7. var currentClass = $(this).attr('class');
  8.  
  9. if(currentClass == "all") {
  10. $("#photo").css("display","block");
  11. } else if (currentClass == "creative") {
  12. $("#photo2").css("display","block");
  13. }
  14.  
  15.  
  16.  
  17. // make sure we cannot click the slider
  18. if ($(this).hasClass('slider')) {
  19. return;
  20. }
  21.  
  22. /* Add the slider movement */
  23.  
  24. // what tab was pressed
  25. var whatTab = $(this).index();
  26.  
  27. // Work out how far the slider needs to go
  28. var howFar = 160 * whatTab;
  29.  
  30. $(".slider").css({
  31. left: howFar + "px"
  32. });
  33.  
  34. /* Add the ripple */
  35.  
  36. // Remove olds ones
  37. $(".ripple").remove();
  38.  
  39. // Setup
  40. var posX = $(this).offset().left,
  41. posY = $(this).offset().top,
  42. buttonWidth = $(this).width(),
  43. buttonHeight = $(this).height();
  44.  
  45. // Add the element
  46. $(this).prepend("<span class='ripple'></span>");
  47.  
  48. // Make it round!
  49. if (buttonWidth >= buttonHeight) {
  50. buttonHeight = buttonWidth;
  51. } else {
  52. buttonWidth = buttonHeight;
  53. }
  54.  
  55. // Get the center of the element
  56. var x = e.pageX - posX - buttonWidth / 2;
  57. var y = e.pageY - posY - buttonHeight / 2;
  58.  
  59. // Add the ripples CSS and start the animation
  60. $(".ripple").css({
  61. width: buttonWidth,
  62. height: buttonHeight,
  63. top: y + 'px',
  64. left: x + 'px'
  65. }).addClass("rippleEffect");
  66. });
  67. });
  68. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement