English 中文(简体)
t Can script
原标题:Can t change this javascript to read less for height than width on mousemove

http://www.n Design-studio.com/demo/css-dock-menu/css-dock.html Query CSS dock menu,你可以接近安装。 邻近地区决定了动物群何时被触发,但你只得走一段距离——高和湿度相同。 我怎么能够改变这一法典,以允许在一对高点和一对宽度的单体内进入,我怎么能够只拿一个数值,但每半个点就有一个垂直的切割? 两种工作: 在此,我认为需要修改的法典范围...... 如果你们需要全事,请让我知道,我将把其余部分放在后面。

jQuery(document).bind( mousemove , function(e) {
  var pointer = jQuery.iUtil.getPointer(e);
  var toAdd = 0;

  if (el.fisheyeCfg.halign && el.fisheyeCfg.halign ==  center ) 
    var posx = pointer.x - el.fisheyeCfg.pos.x 
               - (el.offsetWidth - el.fisheyeCfg.itemWidth * el.fisheyeCfg.items.size())
               / 2 - el.fisheyeCfg.itemWidth / 2;
  else if (el.fisheyeCfg.halign && el.fisheyeCfg.halign ==  right ) 
    var posx = pointer.x - el.fisheyeCfg.pos.x - el.offsetWidth 
               + el.fisheyeCfg.itemWidth * el.fisheyeCfg.items.size();
  else 
    var posx = pointer.x - el.fisheyeCfg.pos.x;

  var posy = Math.pow(pointer.y - el.fisheyeCfg.pos.y - el.offsetHeight / 2, 2);

  el.fisheyeCfg.items.each(function(nr) {
    distance = Math.sqrt(Math.pow(posx - nr * el.fisheyeCfg.itemWidth, 2) + posy);
    distance -= el.fisheyeCfg.itemWidth / 2;
    distance = distance < 0 ? 0 : distance;
    distance = distance > el.fisheyeCfg.proximity ? el.fisheyeCfg.proximity : distance;
    distance = el.fisheyeCfg.proximity - distance;
    extraWidth = el.fisheyeCfg.maxWidth * distance / el.fisheyeCfg.proximity;
    this.style.width = el.fisheyeCfg.itemWidth + extraWidth +  px ;
    this.style.left = el.fisheyeCfg.itemWidth * nr + toAdd +  px ;
    toAdd += extraWidth;
  });
  jQuery.iFisheye.positionContainer(el, toAdd);
});

任何想法?

Thanks,
Matt

最佳回答

我用手稿说几句,最后将其改动比我计划的程度要大。

您现在需要使用以下几条新参数打上文字:> 项目H8proximityXproximity Y

$(document).ready(function() {
 $( #fisheye ).Fisheye({
  maxWidth: 90,
  items:  a ,
  itemsText:  span ,
  container:  .fisheyeContainter ,
  itemWidth: 40,
  itemHeight: 40,
  proximityX: 90,
  proximityY: 10,
  halign :  center 
 })
});

我把它min为,,但这里完全是经过修改的gin:

/**
 * Interface Elements for jQuery
 * Fisheye menu
 * 
 * http://interface.eyecon.ro
 * 
 * Copyright (c) 2006 Stefan Petre
 * Dual licensed under the MIT (MIT-LICENSE.txt) 
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 */

/**
 * Build a Fisheye menu from a list of links
 *
 * @name Fisheye
 * @description Build a Fisheye menu from a list of links
 * @param Hash hash A hash of parameters
 * @option String items items selection
 * @option String container container element
 * @option Integer itemWidth the minimum width for each item
 * @option Integer maxWidth the maximum width for each item
 * @option String itemsText selection of element that contains the text for each item
 * @option Integer proximity the distance from element that make item to interact
 * @option String valign vertical alignment
 * @option String halign horizontal alignment
 *
 * @type jQuery
 * @cat Plugins/Interface
 * @author Stefan Petre
 */
jQuery.iFisheye = {

 build : function(options)
 {

  return this.each(
   function()
   {
    var el = this;
    el.fisheyeCfg = {
     items : jQuery(options.items, this),
     container: jQuery(options.container, this),
     pos : jQuery.iUtil.getPosition(this),
     itemWidth: options.itemWidth,
     itemHeight: options.itemHeight,
     itemsText: options.itemsText,
     proximityX: options.proximityX,
     proximityY: options.proximityY,
     valign: options.valign,
     halign: options.halign,
     maxWidth : options.maxWidth
    };
    jQuery.iFisheye.positionContainer(el, 0);
    jQuery(window).bind(
      resize ,
     function()
     {
      el.fisheyeCfg.pos = jQuery.iUtil.getPosition(el);
      jQuery.iFisheye.positionContainer(el, 0);
      jQuery.iFisheye.positionItems(el);
     }
    );
    jQuery.iFisheye.positionItems(el);
    el.fisheyeCfg.items
     .bind(
       mouseover ,
      function()
      {
       jQuery(el.fisheyeCfg.itemsText, this).get(0).style.display =  block ;
      }
     )
     .bind(
       mouseout ,
      function()
      {
       jQuery(el.fisheyeCfg.itemsText, this).get(0).style.display =  none ;
      }
     );
    jQuery(document).bind(
      mousemove ,
     function(e)
     {
      var pointer = jQuery.iUtil.getPointer(e);
      var toAdd = 0;
      if (el.fisheyeCfg.halign && el.fisheyeCfg.halign ==  center )
       var posx = pointer.x - el.fisheyeCfg.pos.x - (el.offsetWidth - el.fisheyeCfg.itemWidth * el.fisheyeCfg.items.size())/2 - el.fisheyeCfg.itemWidth/2;
      else if (el.fisheyeCfg.halign && el.fisheyeCfg.halign ==  right )
       var posx = pointer.x - el.fisheyeCfg.pos.x - el.offsetWidth + el.fisheyeCfg.itemWidth * el.fisheyeCfg.items.size();
      else 
       var posx = pointer.x - el.fisheyeCfg.pos.x;
      var posy = Math.pow(pointer.y - el.fisheyeCfg.pos.y - el.offsetHeight + el.fisheyeCfg.itemHeight,2);
      el.fisheyeCfg.items.each(
       function(nr)
       {
        distanceX = Math.sqrt(
         Math.pow(posx - nr*el.fisheyeCfg.itemWidth, 2)
        );
        distanceY = Math.sqrt(posy) - el.fisheyeCfg.itemHeight;
        distanceX -= el.fisheyeCfg.itemWidth/2;
        distanceX = distanceX < 0 ? 0 : distanceX;
        distanceX = distanceX > el.fisheyeCfg.proximityX ? el.fisheyeCfg.proximityX : distanceX;
        distanceX = el.fisheyeCfg.proximityX - distanceX;
        distanceY = distanceY > el.fisheyeCfg.proximityY ? el.fisheyeCfg.proximityY : distanceY;
        distanceY = el.fisheyeCfg.proximityY - distanceY;
        extraWidth = el.fisheyeCfg.maxWidth/4 * (distanceX*distanceY)/(el.fisheyeCfg.proximityX*el.fisheyeCfg.proximityY); // divided by 4 to smooth the sizing transition
        extraWidth = (extraWidth > el.fisheyeCfg.maxWidth) ? el.fisheyeCfg.maxWidth : extraWidth;
        this.style.width = el.fisheyeCfg.itemWidth + extraWidth +  px ;
        this.style.left = el.fisheyeCfg.itemWidth * nr + toAdd +  px ;
        toAdd += extraWidth;
       }
      );
      jQuery.iFisheye.positionContainer(el, toAdd);
     }
    );
   }
  )
 },

 positionContainer : function(el, toAdd)
 {
  if (el.fisheyeCfg.halign)
   if (el.fisheyeCfg.halign ==  center )
    el.fisheyeCfg.container.get(0).style.left = (el.offsetWidth - el.fisheyeCfg.itemWidth * el.fisheyeCfg.items.size())/2 - toAdd/2 +  px ;
   else if (el.fisheyeCfg.halign ==  left )
    el.fisheyeCfg.container.get(0).style.left =  - toAdd/el.fisheyeCfg.items.size() +  px ;
   else if (el.fisheyeCfg.halign ==  right )
    el.fisheyeCfg.container.get(0).style.left =  (el.offsetWidth - el.fisheyeCfg.itemWidth * el.fisheyeCfg.items.size()) - toAdd/2 +  px ;
  el.fisheyeCfg.container.get(0).style.width = el.fisheyeCfg.itemWidth * el.fisheyeCfg.items.size() + toAdd +  px ;
 },

 positionItems : function(el)
 {
  el.fisheyeCfg.items.each(
   function(nr)
   {
    this.style.width = el.fisheyeCfg.itemWidth +  px ;
    this.style.left = el.fisheyeCfg.itemWidth * nr +  px ;
   }
  );
 }
};

jQuery.fn.Fisheye = jQuery.iFisheye.build;
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签