Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. (function($){
  2. jQuery.fn.lightTabs = function(options){
  3.  
  4. var createTabs = function(){
  5. tabs = this;
  6. i = 0;
  7.  
  8. showPage = function(i){
  9. $(tabs).children("div").children("div").hide();
  10. $(tabs).children("div").children("div").eq(i).show();
  11. $(tabs).children("ul").children("li").removeClass("active");
  12. $(tabs).children("ul").children("li").eq(i).addClass("active");
  13. }
  14.  
  15. showPage(0);
  16.  
  17. $(tabs).children("ul").children("li").each(function(index, element){
  18. $(element).attr("data-page", i);
  19. i++;
  20. });
  21.  
  22. $(tabs).children("ul").children("li").click(function(){
  23. showPage(parseInt($(this).attr("data-page")));
  24. });
  25. };
  26. return this.each(createTabs);
  27. };
  28. })(jQuery);
  29.  
  30. $(document).ready(function(){
  31. $(".tabs").lightTabs();
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement