Guest User

Untitled

a guest
Jun 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. (function($){
  2. var options;
  3. $.fn.main(opts){
  4. options = opts;
  5. //rest of code
  6. }
  7. $.fn.otherFunc(){
  8. //does something with options
  9. }
  10. }(jQuery));
  11.  
  12. $("#div1, #div2, #div3, #div4, #div5").main(opts);
  13.  
  14. var opts1 = {...};
  15. $("#div1").main(opts1);
  16.  
  17. var opts2 = {...};
  18. $("#div2").main(opts2);
  19.  
  20. // etc.
  21.  
  22. (function($){
  23. var options;
  24. $.fn.main = function(opts){
  25. options = opts;
  26. //rest of code
  27. alert(options.text);
  28. }
  29. $.fn.otherFunc = function(){
  30. //does something with options
  31. }
  32. })(jQuery);
  33.  
  34. $('a:first').main({text:'txt'});
  35. $('a:last').main({text:'some other text'});
Add Comment
Please, Sign In to add comment