Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery.fn.fadeToggle = function(speed, easing, callback) {
- return this.animate({opacity: 'toggle'}, speed, easing, callback);
- }; //thanks @Karl Swedberg for that little bit
- jQuery.fn.instaSwitch = function(switchTarget, switchMethod){
- $(this).click(function(){
- if (switchMethod === "slide"){
- $(switchTarget).slideToggle();
- } else if (switchMethod === "fade"){
- $(switchTarget).fadeToggle();
- } else {
- $(switchTarget).toggle();
- }
- return switchTarget;
- });
- };
- jQuery.fn.countClick = function(direction, increment, start, maximum, loop){
- var counterMain = start;
- $(this).click(function(){
- if (direction === 'up'){
- if (counterMain === maximum){
- if (loop === 'true'){
- counterMain = start;
- }
- else {
- counterMain = counterMain + increment;
- }
- }
- }
- else if (direction === 'down'){
- if (counterMain === start){
- if (loop === 'true'){
- counterMain = maximum;
- }
- else {
- counterMain = counterMain - increment;
- }
- }
- }
- console.log('Count:' + ' ' + counterMain + ' ' + 'Increment:' + ' ' + increment);
- });
- }
Add Comment
Please, Sign In to add comment