jQuery 缩放功能在多次放大和缩小后失败

发布于 2024-10-09 17:29:10 字数 535 浏览 3 评论 0 原文

我正在为 WordPress 网站使用 jQuery Zoomable 地图插件,该网站包含两种类型的地图和图例。目前处于维护模式,尚未向公众开放。我喜欢它的放大和缩小功能。我什至向图例添加了一个触发器,以使图例中的链接触发地图上的放大和缩小,这与以下额外代码一起使用:

jQuery(document).ready(function ($) { $('#area-one-button').click(function() { $('#area-one').click(); }); });

但我一直遇到问题。经过几次放大和缩小后,有时缩放不再起作用,直到我刷新页面或等待几分钟。当我单击图例中的缩小按钮时,我无法再单击地图上的可缩放字段,因为它不知何故不知道我缩小了。这就是问题所在。但如何解决这个问题呢?

所有代码文件的链接位于:http://javascript.pastebin.com/qpEHcDts(只能添加一个链接)

I am using the jQuery Zoomable maps Plugin for a WordPress site with two types of maps and legends. Under maintenance mode right now as it is not open to the public as of yet. I love its zoom in and out functionality. I even added a trigger to the legend to make links in the legend trigger zoom ins and outs on the maps which works with this extra code:

jQuery(document).ready(function ($) {
$('#area-one-button').click(function() {
$('#area-one').click();
});
});

But I have been having issues. After several zoom ins and outs sometimes zooming no longer works until I refresh the page or wait for a few minutes. When I click the zoom out button in the legend I can no longer click on zoomable fields on the map as it somehow does not know I zoomed out. That is the issue. But how to solve this?

Link to all code files is here: http://javascript.pastebin.com/qpEHcDts (could only add one link)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱她像谁 2024-10-16 17:29:10

在 JavaScript 开发人员的帮助下,我成功地基于 jQuery 插件优化了代码,如下所示: http://www.gethifi.com/blog/a-jquery-plugin-for-zoomable-interactive-maps 有点。以下是 legend.js 中的代码,用于使某些区域可点击并立即提高可缩放性。

jQuery(document).ready(function ($) {
    $('#1-coast-button').click(function() {
    $('#1-coast').click();  
        });
    $('#island-1-button').click(function() {
     $('#island-1').click();
    });
    $('#water-button').click(function() {
     $('#water').click();
    });
    $('#2-coast-button').click(function() {
     $('#2-coast').click();
    });
    });

在一个地图页面上加载的基本代码本身相当大,但以下是在一个 .html 地图页面上通过代码加载的弹出窗口之一:

<a href="javascript:void(0)" id="dean-smith" class="bullet" rel="441-342"> </a> 
    <div class="popup" id="dean-smith-box"> 
        <h3>Royal X Resort</h3> 
        <div class="popupcontent"> 
            <p>Text</p> 
        </div>
        <a class="close" href="javascript:void(0)"></a> 
    </div> 

地图现在加载得更好,客户非常满意。

With the help of a JavaScript developer I have managed to optimize the code based on the jQuery plugin as found here: http://www.gethifi.com/blog/a-jquery-plugin-for-zoomable-interactive-maps somewhat. Here is the code in legend.js used to make certain areas clickable and to improve zoomability without delays.

jQuery(document).ready(function ($) {
    $('#1-coast-button').click(function() {
    $('#1-coast').click();  
        });
    $('#island-1-button').click(function() {
     $('#island-1').click();
    });
    $('#water-button').click(function() {
     $('#water').click();
    });
    $('#2-coast-button').click(function() {
     $('#2-coast').click();
    });
    });

The basic code loaded on one map page itself is rather large, but here is one of the pop-ups loaded by code on one .html map page:

<a href="javascript:void(0)" id="dean-smith" class="bullet" rel="441-342"> </a> 
    <div class="popup" id="dean-smith-box"> 
        <h3>Royal X Resort</h3> 
        <div class="popupcontent"> 
            <p>Text</p> 
        </div>
        <a class="close" href="javascript:void(0)"></a> 
    </div> 

Maps do load better now and customer is pretty satisfied.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文