PHP Classes

File: web/js/plugins/ui/jquery.breadcrumbs.js

Recommend this page to a friend!
  Classes of Murat Cileli   Papernic   web/js/plugins/ui/jquery.breadcrumbs.js   Download  
File: web/js/plugins/ui/jquery.breadcrumbs.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Papernic
Manage documents colaboratively
Author: By
Last change:
Date: 7 years ago
Size: 2,719 bytes
 

Contents

Class file image Download
;(function($){ /* Variables */ $.fn.xBreadcrumbs = function(settings){ var element = $(this); var settings = $.extend({}, $.fn.xBreadcrumbs.defaults, settings); function _build(){ if(settings.collapsible){ var sz = element.children('LI').length; element.children('LI').children('A').css('white-space', 'nowrap').css('float', 'left'); element.children('LI').children('A').each(function(i, el){ if(i != sz - 1){ $(this).css('overflow', 'hidden'); $(this).attr('init-width', $(this).width()); $(this).width(settings.collapsedWidth); } }); } element.children('LI').mouseenter(function(){ if($(this).hasClass('hover')){ return; } _hideAllSubLevels(); if(!_subLevelExists($(this))){ return; } // Show sub-level var subLevel = $(this).children('UL'); _showHideSubLevel(subLevel, true); if(settings.collapsible && !$(this).hasClass('current')){ var initWidth = $(this).children('A').attr('init-width'); $(this).children('A').animate({width: initWidth}, 'normal'); } }); element.children('LI').mouseleave(function(){ var subLevel = $(this).children('UL'); _showHideSubLevel(subLevel, false); if(settings.collapsible && !$(this).hasClass('current')){ $(this).children('A').animate({width: settings.collapsedWidth}, 'fast'); } }); }; function _hideAllSubLevels(){ element.children('LI').children('UL').each(function(){ $(this).hide(); $(this).parent().removeClass('hover'); }); }; function _showHideSubLevel(subLevel, isShow){ if(isShow){ subLevel.parent().addClass('hover'); if($.browser.msie){ var pos = subLevel.parent().position(); subLevel.css('left', parseInt(pos['left'])); } if(settings.showSpeed != ''){ subLevel.fadeIn( settings.showSpeed ); } else { subLevel.show(); } } else { subLevel.parent().removeClass('hover'); if(settings.hideSpeed != ''){ subLevel.fadeOut( settings.hideSpeed ); } else { subLevel.hide(); } } }; function _subLevelExists(obj){ return obj.children('UL').length > 0; }; // Entry point _build(); }; /* Default Settings */ $.fn.xBreadcrumbs.defaults = { showSpeed: 'fast', hideSpeed: '', collapsible: false, collapsedWidth: 10 }; })(jQuery);