简体   繁体   中英

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 ). 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).

Is this possible using 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. Apart from that the class you are referencing 'te-s' will most likely not bear the same name again. These name will keep changing. The best solution would be to use a call back from the API, if it exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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