简体   繁体   English

如何调整JavaScript Fisheye脚本的放大触发器?

[英]How do I tweak the JavaScript Fisheye script's enlargement trigger?

I'm using the jQuery Fisheye plugin ( here ) in my site ( link to my site ). 我在我的网站( 链接到我的网站 )中使用jQuery Fisheye插件( 在此处 )。 As you can see there are 9 "bubbles" and when you move your mouse on one of them, it will be enlarged. 如您所见,有9个“气泡”,当您将鼠标移到其中一个上时,它将被放大。

Is it possible to have one of those "bubbles" on its maximum size as default, so when a visitor loads the page he will see 8 small bubbles and one "maximum-sized" bubble? 默认情况下是否可以将其中一个“气泡”的最大大小设为默认值,所以当访问者加载页面时,他会看到8个小气泡和一个“最大”气泡?

EDIT: I tried to add a new css "class" for the "big bubble" effect. 编辑:我试图为“大气泡”效果添加一个新的CSS“类”。 Now the problem is (as you can see in the link attched above) that the big bubble appears to be on-top of the small bubble to the left. 现在的问题是(如您在上面的链接中看到的那样),大气泡似乎在左侧小气泡的顶部。

I tried to add margin and padding to the big-bubble style but it doesn't help, I guess because all the small bubbles are float:right . 我试图在大气泡样式中添加marginpadding ,但这并没有帮助,因为所有小气泡都是float:right

My html/php code: 我的html / php代码:

<script type="text/javascript">

    $(document).ready(
        function()
        {
            $('#dock2').Fisheye(
                {
                    maxWidth: 150,
                    items: 'a',
                    itemsText: 'span',
                    container: '.dock-container2',
                    itemWidth: 80,
                    proximity: 80,
                    halign : 'center',
                    valign : 'bottom'
                }
            )


            $('#auto_big').addClass('dock-item2-big');

            $('.dock-item2').mouseover(function() {
                $('#auto_big').removeClass('dock-item2-big');
            });
            $('.dock-item2').mouseout(function() {
                $('#auto_big').addClass('dock-item2-big');
            });


        }
    );

</script>
    <div class="dock2" id="dock2">
  <div class="dock-container2">
<?php $categories = $this->requestAction('categories/index/direction:asc/limit:9'); ?>
<?php foreach ($categories as $category): ?>

    <?php
        if($category['Category']['id'] == 27)
            $special = " id='auto_big'";
        else
            $special = "";
    ?>

  <a class="dock-item2" href="/categories/show/<?=$category['Category']['id'];?>"<?=$special?>><span><img src='/img/cat/<?=$category['Category']['id'];?>_title.png'></span><img src="/img/cat/<?php echo $category['Category']['picture']; ?>" alt="<?php echo $category['Category']['name']; ?>" /></a> 
 <?php endforeach; ?>
  </div> 
</div>

My style: 我的风格:

/* dock2 - bottom */
#dock2 {
    width: 100%;
    bottom: 0px;
    position: relative;
    left: 0px;
}
.dock-container2 {
    position: absolute;
    height: 50px;
    /*background: url(images/dock-bg.gif);*/
    /*padding-left: 20px;*/
}
a.dock-item2 {
    display: block; 
    font: bold 12px Arial, Helvetica, sans-serif;
    width: 40px; 
    color: #000; 
    bottom: 0px; 
    position: absolute;
    text-align: center;
    text-decoration: none;
}
.dock-item2 span {
    display: none;
    padding-left: 20px;
    font-size:20px;
    float:right;

}
.dock-item2 img {
    border: none; 
    margin: 5px 10px 0px; 
    width: 100%; 
}



a.dock-item2-big {
    display: block; 
    font: bold 12px Arial, Helvetica, sans-serif;
    width: 200px; 
    color: #000; 
    bottom: 0px; 
    position: absolute;
}
.dock-item2-big span {
    display:block;
    padding-left: 20px;
    font-size:20px;
    float:right;

}

.dock-item2-big img {
    border: none; 
    width: 220px;
}

As the items start to resize when the mouse is near (not over), i'd say it's based on mouse location. 当鼠标靠近(不超过)时,这些项目开始调整大小,我想说这是基于鼠标的位置。 As you can't move the mouse cursor with javascript, I don't think you can trigger this. 由于您无法使用javascript移动鼠标光标,因此我认为您无法触发此操作。

Time to find another method, such as setting the proportions of your large element in CSS. 是时候找到另一种方法了,例如在CSS中设置大元素的比例。 If you open up Firebug (or another inspector) and watch the element, you'll see the left and width being changed as the mouse gets nearer. 如果打开Firebug(或其他检查器)并观察该元素,则随着鼠标越来越靠近,您将看到左侧和宽度发生变化。 Pick some values and set them via CSS. 选择一些值并通过CSS进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何调整响应表的JavaScript以在移动设备中选择其他列 - How do I tweak a responsive table’s JavaScript to select a different column in mobile Javascript:如何调整反跳功能以采用IF条件? - Javascript: How do I tweak my debounce function to take an IF conditional? 如何更改此javascript以在加载时触发? - how do I change this javascript to trigger on load? 如何使用 JavaScript 触发模态? - How do I trigger a Modal with JavaScript? 如何触发JavaScript事件触发器? - How do I fire a JavaScript event trigger? 如何触发Javascript中的表单提交? - How do I trigger Form Submission in Javascript? 如何依次执行以下功能:1.放大-&gt; 2.旋转360度-&gt; 3.放大至放大前的尺寸-&gt; 4.更改颜色(切换) - How can I do the functions in order: 1. enlarge -> 2. rotate 360 degrees -> 3. resize to before enlargement -> 4. change color (toggle) 如何使用javascript触发按键事件? - How do I trigger a key event with javascript? 如何触发附加到页面的内联Javascript? (ASP.NET Web表单) - How do I trigger inline Javascript that's appended to my page? (ASP.NET webforms) 如何将变量从 Django 的 render 方法的上下文参数传递给前端的 javascript 脚本? - How do I pass a variable from Django's render method's context param to a javascript script on the frontend?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM