javascript - about php full calendar -


when click on item in calendar show particular task. after 1 second calendar disappear. want show task without disappearing. when add function call calendar according item, problem has started.

this code jquery

{     guyid = "";      $('.guyid').click(function (){         this.guyid = $(this).attr('id');     //  alert('test:'+this.guyid);             calendercall(this.guyid);      });      function calendercall(guyid){  //alert(guyid);         $('#calendar').fullcalendar({                 header: {                     left: 'prev,next today',                     center: 'title',                     right: 'month,basicday'                 },                 editable: true,                 eventlimit: true, // allow "more" link when many events                  events: [                     {                         title: guyid,                         start: '2016-02-04'                     },                     {                         title: 'event1',                         start: '2016-02-04'                     },                      {                         title: 'event1',                         start: '2016-02-17'                     },                     {                         title: 'long event',                         start: '2016-02-06',                         end: '2016-02-10'                     }                      // etc...                     ],                     color: 'yellow',   // option!                     textcolor: 'black' // option!         });     }  }); 

this body part

<!-- <div style="width: auto; height: 200px; border: 2px solid black;"></div> --> <a href="tasks.php"><b>tasks</b></a><br> <div style="position: absolute;"> <?php     $phplink = mysql_connect('localhost:3306', 'root', '');     if (!$phplink) {         die("could not connect:" .mysql_error());     }     $db = mysql_select_db('jhoro_pm', $phplink) or die("could not connect db:" .mysql_error());     $result_guy = mysql_query("select id, name, can_login person can_login=1");     while ($row_guy=mysql_fetch_array($result_guy)) {         //echo '<input type="hidden" class="guyid" value="' .$row_guy[0]. '" />';         echo '<a href="index.php" class="guyid" id="' .$row_guy[0]. '">' .$row_guy[1]. '</a><br>';     } ?> 

this item without calendar. when click of them task show calendar. after 1 second calendar disappears

enter image description here

ok, have below

first of change code below one.

<!-- <div style="width: auto; height: 200px; border: 2px solid black;"></div> --> <a href="tasks.php"><b>tasks</b></a><br> <div style="position: absolute;"> <?php     $phplink = mysql_connect('localhost:3306', 'root', '');     if (!$phplink) {         die("could not connect:" .mysql_error());     }     $db = mysql_select_db('jhoro_pm', $phplink) or die("could not connect db:" .mysql_error());     $result_guy = mysql_query("select id, name, can_login person can_login=1");     while ($row_guy=mysql_fetch_array($result_guy)) {         echo '<a href="javascript:void(0);" class="guyid" id="' .$row_guy[0]. '">' .$row_guy[1]. '</a><br>';      }          echo '<input type="hidden" id="selectedperson" class="guyid" value="' .$row_guy[0]. '" />'; ?> 

1) remove href="index.php" anchor tag. (href call every click, that's why calendar disappears. 2) set hidden field selected person. (out side while loop).

now, fine tunning of jquery code.

{     guyid = "";      $('.guyid').click(function (){         this.guyid = $(this).attr('id');         $('#selectedperson').val(this.guyid);         $('#calendar').fullcalendar('rerenderevents');     });          $('#calendar').fullcalendar({                 header: {                     left: 'prev,next today',                     center: 'title',                     right: 'month,basicday'                 },                 editable: true,                 eventlimit: true, // allow "more" link when many events                  events: [                     {                          title: 1,                         start: '2016-02-04'                     },                     {                         title: 2,                         start: '2016-02-04'                     },                      {                         title: 3,                         start: '2016-02-17'                     },                     {                         title: 4,                         start: '2016-02-06',                         end: '2016-02-10'                     }                      ],                     eventrender: function(event, element) {                        return (($('#selectedperson').val()) == event.title);                    },                     color: 'yellow',   // option!                     textcolor: 'black' // option!         }); }); 

this work surely. if still stuck anywhere, add comment.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -