⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spmenu.js

📁 一种Portal的实现源码
💻 JS
📖 第 1 页 / 共 5 页
字号:
          this.SolpartMenuTransitionObject.constant=true;
          this.doFilter();
        }
        break;
      }
      case 'Inset': case 'RadialWipe': case 'Slide': case 'Spiral': case 'Stretch': case 'Strips': case 'Wheel': case 'GradientWipe': case 'Zigzag': case 'Barn': case 'Blinds': case 'Checkerboard': case 'Fade': case 'Iris': case 'RandomBars':
      {
        oMenu.filters('DXImageTransform.Microsoft.' + this.menuTransition).apply();
        oMenu.filters('DXImageTransform.Microsoft.' + this.menuTransition).duration = this.menuTransitionLength;
        oMenu.filters('DXImageTransform.Microsoft.' + this.menuTransition).play();
        break;
      }
    }
  }

  //--- applys transition filter ---//
  SolpartMenu.prototype.doFilter = function (bStop) 
  {      
    if (this.SolpartMenuTransitionObject.id == null)
      return;
      
    var o = spm_getById(this.SolpartMenuTransitionObject.id);
    window.status = new Date();
    switch (this.menuTransition)
    {
      case 'AlphaFade':
      {
        if (this.SolpartMenuTransitionObject.stop)
        {
          o.filters('DXImageTransform.Microsoft.Alpha').opacity = 100;
        }
        else
        {
          o.filters('DXImageTransform.Microsoft.Alpha').opacity = this.SolpartMenuTransitionObject.opacity;
          if (this.SolpartMenuTransitionObject.opacity < 100)
          {
            setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].doFilter()', 50);
            this.SolpartMenuTransitionObject.opacity += (100/20* this.menuTransitionLength);
          }
        }
        break;
      }
      case 'Wave': case 'ConstantWave':
      {
        if (this.SolpartMenuTransitionObject.stop)
        {
            o.filters("DXImageTransform.Microsoft.Wave").freq = 0;
            o.filters("DXImageTransform.Microsoft.Wave").lightstrength = 0;
            o.filters("DXImageTransform.Microsoft.Wave").strength = 0;
            o.filters("DXImageTransform.Microsoft.Wave").phase = 0;
        }
        else
        {
          o.filters("DXImageTransform.Microsoft.Wave").freq = 1;
          o.filters("DXImageTransform.Microsoft.Wave").lightstrength = 20;
          o.filters("DXImageTransform.Microsoft.Wave").strength = 5;
          o.filters("DXImageTransform.Microsoft.Wave").phase = this.SolpartMenuTransitionObject.phase;

          if (this.SolpartMenuTransitionObject.phase < 100 * this.menuTransitionLength || this.SolpartMenuTransitionObject.constant == true)
          {
            setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].doFilter()', 50);
            this.SolpartMenuTransitionObject.phase += 5;
          }
          else
          {
            o.filters("DXImageTransform.Microsoft.Wave").freq = 0;
            o.filters("DXImageTransform.Microsoft.Wave").lightstrength = 0;
            o.filters("DXImageTransform.Microsoft.Wave").strength = 0;
            o.filters("DXImageTransform.Microsoft.Wave").phase = 0;
          }
        }
        break;
      }
    }
  }          
  



  //--- handles mouseover for menu item ---//
	SolpartMenu.prototype.handlembi_mo = function (oRow)
	{
		var sID = oRow.id.substr(2);

		spm_getById("icon" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmicn') + this.cssMenuIcon + ' ' + this.cssMenuItemSel);
		spm_getById("td" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel') + this.cssMenuItemSel);
		spm_getById("arrow" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmarw') + this.cssMenuItemSel + ' ' + this.cssMenuArrow);
		
		spm_applyRowBorder(oRow, 1, this.selBorderColor, true);

	
		if (this._m_aOpenMenuID[this._m_aOpenMenuID.length - 1] != oRow.id.replace('tr', ''))
		{
			this.handleNewItemSelect(spm_getAttr(oRow, "parentID", ""));
		
			if (spm_getById("tbl" + sID) != null)
			{
				var iWidth;
				oMenu = spm_getById("tbl" + sID);

				var oPDims = new spm_elementDims(oRow);
				var oMDims = new spm_elementDims(oMenu);
				        			
				oMenu.style.top = oPDims.t;
				
				spm_resetScroll(oMenu);

				this.doTransition(oMenu);

				oMDims = new spm_elementDims(oMenu);	//now that we moved need to reget dims
				oMenu.style.display = "";

			  if (oMDims.t - spm_getBodyScrollTop() + oMDims.h > spm_getViewPortHeight())
			  {
				  if (oMDims.h < spm_getViewPortHeight())
						oMenu.style.top = spm_getViewPortHeight() + spm_getBodyScrollTop() - oMDims.h;
					else
					{
						spm_handleScrollMenu(this, oMenu);
						oMDims = new spm_elementDims(oMenu);	//now that we moved need to reget dims
					}
			  }

				if (this.direction == 'rtl')
				{
					oMenu.style.display = "";
					oMenu.style.left = oPDims.l - oMDims.w - spm_getBodyScrollLeft();
					oMenu.style.display = "none";
				}
				else
					oMenu.style.left = oPDims.l + oPDims.w - spm_getBodyScrollLeft();

				if (this.direction == 'rtl')
				{
					if (oMDims.l - spm_getBodyScrollLeft() < 0)
						oMenu.style.left = oPDims.l + oPDims.w - spm_getBodyScrollLeft();
				}
				else  
				{
					if (oPDims.l - spm_getBodyScrollLeft() + oPDims.w + oMDims.w > spm_getViewPortWidth())
						oMenu.style.left = oPDims.l - oMDims.w - spm_getBodyScrollLeft();
				}
									
					
				this._m_aOpenMenuID[this._m_aOpenMenuID.length] = sID;
				if (this.useIFrames)
					spm_iFrameIndex(oMenu, true);
				else
					spm_hideElement("SELECT|OBJECT",oMenu);

			}
		}
		this.fireEvent('onMenuItemMouseOver', oRow);
		
	}
	
  //--- handles mouseout for menu item ---//
	SolpartMenu.prototype.handlembi_mout = function (oRow)
	{
			var sID = oRow.id.substr(2);

			oRow.className = spm_fixCSSForMac(this.getIntCSSName('spmitm') + ' ' + this.cssMenuItem + ' ' + spm_getAttr(oRow, 'savecss', ''));
		  spm_getById("icon" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmicn') + this.cssMenuIcon);
		  spm_getById("td" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitm') + ' ' + this.cssMenuItem + ' ' + spm_getAttr(oRow, 'savecss', ''));
		  spm_getById("arrow" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmarw') + this.cssMenuArrow);
			
			spm_applyRowBorder(oRow, 1, "", false);

      this.stopTransition();
	}

  //used for raising events to client javascript
  SolpartMenu.prototype.fireEvent = function (sEvent, src) 
  {
		return; //disabled for now
    if (eval('this.' + sEvent + ' != null'))
		{
			var e = new Object();
			if (src != null)
				e.srcElement = src;
			else
				e.srcElement = this._m_oMenu;
				
				eval('this.' + sEvent + '(e)');
		}
  }

	//--- called by setTimeOut to check mouseout hide delay ---//
	SolpartMenu.prototype.hideMenuTime = function ()
  {
    if (this._m_dHideTimer != null && this.moutDelay > 0)
    {
      if (new Date() - this._m_dHideTimer >= this.moutDelay)
      {
        this.hideAllMenus();
        this._m_dHideTimer = null;
      }
      else
        setTimeout(this.hideMenuTime, this.moutDelay);
    }
  }

	//--- called by setTimeOut to check mouseout hide delay ---//
	SolpartMenu.prototype.scrollMenu = function ()
  {
		if (this._m_oScrollingMenu != null)
		{
			if (spm_ScrollMenuClick(this._m_oScrollingMenu) == false)
				setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].scrollMenu()', 500);
			else
				this._m_oScrollingMenu = null;
		}
  }

//global
	function spm_iFrameIndex(eMenu, bShow)
	{
		if (spm_browserType() == 'op')
			return;	//not needed
			
		if (bShow)
		{
			var oIFR=spm_getById('ifr' + eMenu.id);
			if (oIFR == null)
			{
				var oIFR = document.createElement('iframe');
				oIFR.id = 'ifr' + eMenu.id;
				oIFR.src = '';
				oIFR.style.top = 0;
				oIFR.style.left = 0;
				oIFR.scrolling = 'no';
				oIFR.frameBorder = 'no';
				oIFR.style.display = 'none';
				oIFR.style.position = 'absolute';
				document.body.appendChild(oIFR);
			}
			var oMDims = new spm_elementDims(eMenu);
			
			oIFR.style.width=oMDims.w-2;
			oIFR.style.height=oMDims.h-2;
			oIFR.style.top=oMDims.t;
			oIFR.style.left=oMDims.l;
			
			if (eMenu.style.zIndex == 0)
				eMenu.style.zIndex = 1;
			oIFR.style.zIndex=eMenu.style.zIndex-1;
			oIFR.style.display="block";
		}
		else if (spm_getById('ifr' + eMenu.id) != null)
		{
			spm_getById('ifr' + eMenu.id).style.display='none';
		}
	}

	function spm_showElement(elmID)
	{
		if (spm_browserType() == 'op')
			return;	//not needed

		// Display any element that was hidden
		var sTags = elmID.split('|');
		for (var x=0; x<sTags.length; x++)
		{
			elmID = sTags[x];
			for (var i = 0; i < spm_getTags(elmID).length; i++)
			{
				obj = spm_getTags(elmID)[i];
				if (! obj || ! obj.offsetParent)
					continue;
				obj.style.visibility = "";
			}
		}
	}

	function spm_hideElement(elmID, eMenu)
	{
		if (spm_browserType() == 'op')
			return;	//not needed

		var obj;
		// Hide any element that overlaps with the dropdown menu
		var sTags = elmID.split('|');
		
		var oMDims = new spm_elementDims(eMenu);
		
		for (var x=0; x<sTags.length; x++)
		{
			elmID = sTags[x];
			for (var i = 0; i < spm_getTags(elmID).length; i++)
			{
				obj = spm_getTags(elmID)[i];
				var oODims = new spm_elementDims(obj);
				
				if (oODims.t > oMDims.t + oMDims.h)
				{
					//if element is below bottom of menu then do nothing
				}
				else if (oODims.l > oMDims.l + oMDims.w)
				{
					//if element is to the right of menu then do nothing
				}
				else if (oODims.l + oODims.w < oMDims.l)
				{
					//if element is to the left of menu then do nothing
				}
				else if (oODims.t + oODims.h < oMDims.t)
				{
					//if element is to the top of menu then do nothing
				}
				else
				{
					obj.style.visibility = "hidden";
				}
			}
		}
	}

	function spm_positionMenu(me, oMenu, oCell)
	{
		spm_resetScroll(oMenu);

		var oPDims = new spm_elementDims(oCell, false, me);
		
		if (me.display == 'vertical')
		{
			var oMDims = new spm_elementDims(oMenu);
			oMenu.style.top = oPDims.t;

			if (oPDims.t - oMDims.h - spm_getBodyScrollTop() > 0) //only do this if it fits
				oMenu.style.top = oPDims.t;	//place above menu bar
			else
				spm_handleScrollMenu(me, oMenu);
			
			var oOrigMDims;
			
			if (spm_browserType() != 'ie') //since mozilla doesn't set width greater than window size we need to store it here
				 oOrigMDims = new spm_elementDims(oMenu);
			
			oMenu.style.left = oPDims.l + oPDims.w - spm_getBodyScrollLeft();
			oMDims = new spm_elementDims(oMenu);
			if (oOrigMDims == null)
				oOrigMDims = oMDims;
			
			if (oMDims.l - spm_getBodyScrollLeft(true) + oOrigMDims.w > spm_getViewPortWidth())
			{
			  if (spm_getViewPortWidth() - oOrigMDims.w > 0)  //only do this if it fits
				  oMenu.style.left = oPDims.l - oOrigMDims.w - spm_getBodyScrollLeft(true);
			}

			//oMenu.style.display = "";
		}
		else
		{
			oMenu.style.left = oPDims.l - spm_getBodyScrollLeft();
			oMenu.style.top = oPDims.t + oPDims.h;
			var oMDims = new spm_elementDims(oMenu);
			
			if (oMDims.l - spm_getBodyScrollLeft(true) + oMDims.w > spm_getViewPortWidth())
			{
			  if (spm_getViewPortWidth() - oMDims.w > 0)  //only do this if it fits
				  oMenu.style.left = spm_getViewPortWidth() - oMDims.w + spm_getBodyScrollLeft(true);
			}
			
			if (oMDims.t - spm_getBodyScrollTop() + oMDims.h > spm_getViewPortHeight())
			{
			  if (oPDims.t - oMDims.h - spm_getBodyScrollTop() > 0) //only do this if it fits
				  oMenu.style.top = oPDims.t - oMDims.h;	//place above menu bar
				else
					spm_handleScrollMenu(me, oMenu);
			}
			//oMenu.style.display = "none";
		}
	}

	//--------- Internal (private) Functions --------//
	//--- Applies border to cell ---//
	SolpartMenu.prototype.applyBorder = function (oCell, iSize, sTopLeftColor, sBottomRightColor, sStyle)
	{
		if (this.moDisplay == 'Outset')
		{
			if (sStyle == null)
				sStyle = "solid";

			if (sTopLeftColor.length > 0 && sBottomRightColor.length > 0)
			{
				if (oCell.tagName == 'TR')
					oCell = oCell.childNodes(0);
				
				oCell.style.borderTop = sStyle + " " + iSize + "px " + sTopLeftColor;
				oCell.style.borderLeft = sStyle + " " + iSize + "px " + sTopLeftColor;
				oCell.style.borderRight = sStyle + " " + iSize + "px " + sBottomRightColor;
				oCell.style.borderBottom = sStyle + " " + iSize + "px " + sBottomRightColor;	
				
			}
		}
		if (this.moDisplay == 'HighLight')
		{
			if (sTopLeftColor == this.backColor)
			{
				//oCell.style.backgroundColor = '';
        //setClassColor(oCell, 'spmitm', '');
        oCell.className = spm_fixCSSForMac(this.getIntCSSName('spmbar spmitm') + this.cssMenuItem + spm_getAttr(oCell, 'savecss', ''));
			}
			else
			{
				//oCell.style.backgroundColor = this.selColor;
        //setClassColor(oCell, 'spmitm', this.selForeColor);
        oCell.className = spm_fixCSSForMac(this.getIntCSSName('spmbar spmitmsel') + this.cssMenuItemSel);
			}
		}		
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -