Expand your interval and make it a function so that you can perform both tasks that you want to call.
setInterval( function() { if ( $('#datacheck').is(":visible") ) { $('#datacheck').slideUp('slow'); } activitycheck(); }, 5000 );
When you call your interval to call the activitycheck () function, it also checks if #datacheck is currently displayed, and if it will trigger a slideshow to hide it.
UPDATE:
Perhaps I misunderstood your intention. If you want each new identifier to be unloaded as it arrives, you will need to provide links to the identifiers contained in #datacheck. You can do this dynamically without changing your data, providing a wrapper for each identifier that jQuery can reference. So your example could be changed like this ...
if ( var_IDcheck < verify['id']) { var_IDcheck = verify['id']; for ( var i = 0; i < var_IDcheck; i++ ){ var id_wrapper = '<div id="' + var_IDcheck + '" style="display:none;">' + var_IDcheck + '</div>'; $('#datacheck').prepend(id_wrapper); $('#' + var_IDcheck).delay(300).slideDown('slow'); } }
The delay just gives a little time for the prefix to complete before it crawls down. Also, using the IDcheck value to wrap a div id ensures that you do not accidentally generate the same div identifiers.
source share