Jump to content

[SOLVED] jquery - Stuck on a .toggle can't close the item again


c_shelswell

Recommended Posts

Hi I've got a page that's a calendar. Users can add events to each date. If there's an event then a marker shows on that date that a user can click on to see a jquery popup of the event. This all works great for multiple events on one page. The problem i'm having is closing the popup after it's open. I don't know if it's because i want to open it with one button but close it with a generic one on the popup. Any help would be great. My code is below thanks.

 

<script type="text/javascript">
   $(document).ready(function()
   {
      $('[class^=toggle-item]').hide();
      
      $('[class^=link]').click(function()
      {
         var $this = $(this);
         var x = $this.attr("className");
         
         $('.toggle-item-' + x).toggle(400);
         return false;
      });
      
      $('.closeEvent').click(function()
      {
         var $this = $(this);
         var x = $this.attr("className");
         
         $('.toggle-item-' + x).toggle(400);
      });
         
</script>

   <table border='0' width='455px' cellpadding='2' cellspacing='2' class='calendarTable'>
      <tr >
         <td class='calCellTop'>SUN</td>
         <td class='calCellTop'>MON</td>
         <td class='calCellTop'>TUE</td>
         <td class='calCellTop'>WED</td>
         <td class='calCellTop'>THU</td>

         <td class='calCellTop'>FRI</td>
         <td class='calCellTop'>SAT</td>
      </tr>
   <tr>
<td class='calCell' valign='middle'><div class='eventMarker'><a href='#' class='link2'>x</a></div><div class='hiddenEvent toggle-item-link2'><a href='#' class='closeEvent'>close X</a><br />Start Time: 1233485100<br />End Time: 1233495900<br />Event: The event<br />Venue: the venue<br />Start Time: the details</div><a href='#' class='calLink addEvent'><span class='link'>1</span></a></td>

<td class='calCell' valign='middle'><a href='#' class='calLink addEvent'><span class='link'>2</span></a></td>
<td class='calCell' valign='middle'><a href='#' class='calLink addEvent'><span class='link'>3</span></a></td>
<td class='calCell' valign='middle'><a href='#' class='calLink addEvent'><span class='link'>4</span></a></td>
<td class='calCell' valign='middle'><a href='#' class='calLink addEvent'><span class='link'>5</span></a></td>
<td class='calCell' valign='middle'><a href='#' class='calLink addEvent'><span class='link'>6</span></a></td>
<td class='calCell' valign='middle'><a href='#' class='calLink addEvent'><span class='link'>7</span></a></td>
</tr>
</table>

 

The line in the table with the 'closeEvent' tag is the one i'm hoping to close the div with. Hope this makes sense if not I could upload the site.

 

Cheers

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.