WordPress.org

Support

Support » Plugins and Hacks » [Resolved] My Calendar Event popup doesn't close (fix)

[Resolved] My Calendar Event popup doesn't close (fix)

  • Steve
    Member

    @stevecordle

    When you click the X (Close Button) it removes the X but does not close the popup.

    The problem is that WordPress is doing the awesome little wpautop. So on my site this is the html for the popup.

    <div id="mc_1-03-calendar-details" class="details" style="display: block;">
    <p><a href="#mc_1-03-calendar" class="mc-toggle mc-close close"><img src="http://kcuc.org/wp-content/plugins/my-calendar/images/event-close.png" alt="Close"></a>
    </p><div class="time-block">
    <p><span class="mc-event-date">July 3, 2014</span><br>
    <span class="event-time dtstart"><time datetime="2014-07-03T10:30:00">10:30 am</time><span class="time-separator"> – </span><time class="end-time dtend" datetime="2014-07-03T15:15:00">3:15 pm</time></span></p></div>
    <div class="location"></div>
    <div class="longdesc">
    <p>test description</p>
    </div>
    <div class="shortdesc"></div>
    <div class="sharing"></div>
    </div>

    The javascript used for the close button is in the my-calendar-install.php file.

    // defaults will go into the options table on a new install
    $initial_caljs = '$(function() {
      $(".calendar-event").children().not(".event-title").hide();
      $(document).on("click", ".calendar-event .event-title",
         function(e) {
             e.preventDefault(); // remove line if you are using a link in the event title
    		$(this).parent().children().not(".event-title").toggle();
    	 });
      $(document).on("click", ".calendar-event .close",
         function(e) {
             e.preventDefault();
    		$(this).parent().toggle();
    	 });
    	});';

    The problem here is that the parent of the x is actually a <p> tag that is wrapped around the close button, caused by the wordpress wpautop crap.

    You could use .parent().parent() to do this, but I used your calendar on another site and that site didn’t have the extra p tag added.

    The best solution would be to change the parent().toggle(); to:

    $(this).closest("div.details").toggle();

    So it will find the closest div with a class name of details as it travels up the dom and toggle that.

    https://wordpress.org/plugins/my-calendar/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Joe Dolson
    Participant

    @joedolson

    Thanks! That’s a good suggestion. The whole world of wpautop can be maddening…

    Best,
    Joe

    Hello, I am having the same issue

    I dont know where to place the html above

    I replaced the js from
    $(this).parent().toggle();
    to
    $(this).closest(“div.details”).toggle();

    but I still have the same problem.

    Plugin Author Joe Dolson
    Participant

    @joedolson

    Please don’t make comments on resolved support threads; it’s only a freak chance that I looked at this — I generally don’t look at support threads if they’re marked “resolved”.

    If you can create a new support thread, provide a link to this one, and provide a link to your site, I may be able to help you.

    Alternately, you can submit a support request at My Calendar > Help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] My Calendar Event popup doesn't close (fix)’ is closed to new replies.