Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.31 KB | None | 0 0
  1. base.buildNavigation = function() {
  2.  
  3.             if (base.options.buildNavigation && (base.pages > 1)) {
  4.                 base.$items.filter(':not(.cloned)').each(function(i,el) {
  5.                     var index = i + 1,
  6.                         klass = ((index == 1) ? 'first' : '') + ((index == base.pages) ? 'last' : ''),
  7.                         $a = $('<a href="#"></a>').addClass('panel' + index).wrap('<li class="' + klass + '" />');
  8.                     base.$nav.append($a.parent()); // use $a.parent() so IE will add <li> instead of only the <a> to the <ul>
  9.  
  10.                     // If a formatter function is present, use it
  11.                     if ($.isFunction(base.options.navigationFormatter)) {
  12.                         var tmp = base.options.navigationFormatter(index, $(this));
  13.                         $a.html(tmp);
  14.                         // Add formatting to title attribute if text is hidden
  15.                         if (parseInt($a.css('text-indent'),10) < 0) { $a.addClass(base.options.tooltipClass).attr('title', tmp); }
  16.                     } else {
  17.                         $a.text(index);
  18.                     }
  19.  
  20.                     $a.bind(base.options.clickControls, function(e) {
  21.                         if (!base.flag && base.options.enableNavigation) {
  22.                             // prevent running functions twice (once for click, second time for focusin)
  23.                             base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
  24.                             base.gotoPage(index);
  25.                             if (base.options.hashTags) { base.setHash(index); }
  26.                         }
  27.                         e.preventDefault();
  28.                     });
  29.                 });
  30.             }
  31.         };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement