Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. (function($) {
  2.  
  3. $.fn.addimate = function(noOfImages, prefix, x, extension, interval) {
  4.  
  5. if (x > noOfImages) {
  6. x = 1;
  7. }
  8.  
  9. console.log($(this).attr("id") + "n" + prefix + x + extension + "n" + interval);
  10. $(this).attr("src", prefix + x + extension);
  11. x ++;
  12.  
  13. setTimeout(function() {
  14. $(this).addimate(noOfImages, prefix, x, extension, interval);
  15. }, interval);
  16. }
  17.  
  18. }) (jQuery);
  19.  
  20. (function($) {
  21.  
  22. $.fn.addimate = function(noOfImages, prefix, x, extension, interval) {
  23.  
  24. //Intentionally deleted content.
  25. }; //AND you're missing a semicolon here
  26.  
  27. }) (jQuery);
  28.  
  29. (function($) {
  30.  
  31. $.fn.addimate = function(noOfImages, prefix, x, extension, interval) {
  32.  
  33. var $this = this; //This will maintain the context of the jQuery object.
  34.  
  35. if (x > noOfImages) {
  36. x = 1;
  37. }
  38.  
  39. console.log(this.attr("id") + "n" + prefix + x + extension + "n" + interval);
  40. this.attr("src", prefix + x + extension);
  41. x++;
  42.  
  43. setTimeout(function() {
  44. $this.addimate(noOfImages, prefix, x, extension, interval);
  45. }, interval);
  46. };
  47.  
  48. }(jQuery));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement