Guest User

Untitled

a guest
Jul 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. jQuery.fn.fadeToggle = function(speed, easing, callback) {
  2. return this.animate({opacity: 'toggle'}, speed, easing, callback);
  3. }; //thanks @Karl Swedberg for that little bit
  4. jQuery.fn.instaSwitch = function(switchTarget, switchMethod){
  5. $(this).click(function(){
  6. if (switchMethod === "slide"){
  7. $(switchTarget).slideToggle();
  8. } else if (switchMethod === "fade"){
  9. $(switchTarget).fadeToggle();
  10. } else {
  11. $(switchTarget).toggle();
  12. }
  13. return switchTarget;
  14. });
  15. };
  16. jQuery.fn.countClick = function(direction, increment, start, maximum, loop){
  17. var counterMain = start;
  18. $(this).click(function(){
  19. if (direction === 'up'){
  20. if (counterMain === maximum){
  21. if (loop === 'true'){
  22. counterMain = start;
  23. }
  24. else {
  25. counterMain = counterMain + increment;
  26. }
  27. }
  28. }
  29. else if (direction === 'down'){
  30. if (counterMain === start){
  31. if (loop === 'true'){
  32. counterMain = maximum;
  33. }
  34. else {
  35. counterMain = counterMain - increment;
  36. }
  37. }
  38. }
  39. console.log('Count:' + ' ' + counterMain + ' ' + 'Increment:' + ' ' + increment);
  40. });
  41. }
Add Comment
Please, Sign In to add comment