简体   繁体   English

使用jquery拦截Google日历上的点击事件

[英]Intercept click-event on Google Calendar with jquery

I am trying to do my own stuff when I click on a event in my embedded Google Calendar ( iframe ). 当我单击嵌入式Google日历( iframe )中的事件时,我正在尝试做自己的事情。 My code so far: 到目前为止,我的代码:

<script type="text/javascript">
    $(document).on('click', function (e) {
        if ($(this).hasClass('te-s')) {
            e.preventDefault();
            e.stopImmediatePropagation();
        }
    });

    $(function () {
        $('.te-s').bind("click", function () {
            alert("test");
        });
</script>



te-s is the class containing the event-text, and instead of showing this additional details bubble, I (later) want to redirect on my own site (alert is only there for test purposes). te-s是包含事件文本的类,而不是显示此其他详细信息气泡,我(后)希望在自己的站点上重定向(警报仅用于测试目的)。

Is this possible using jquery? 使用jquery可以吗?

Im not sure this is possible. 林不知道这是可能的。 I guess your script would have to be within the child iframe to be able to listen to events within it. 我猜想您的脚本必须位于子iframe中,才能侦听其中的事件。 Apart from that the class you are referencing 'te-s' will most likely not bear the same name again. 除了该类之外,您引用的“ te-s”类很可能不会再使用相同的名称。 These name will keep changing. 这些名称将不断变化。 The best solution would be to use a call back from the API, if it exists. 最好的解决方案是使用从API进行的回调(如果存在)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM