Note that there are some explanatory texts on larger screens.

plurals
  1. POIn a chat room implemented using PHP & jQuery ajax method, how can i put emoticons/ smileys?
    text
    copied!<p>I created 3 pages- <code>mainpage.php</code>, <code>post.php</code>, <code>display.php</code>.<br> mainpage has the main chat interface with a div id 'chatbox', and a textarea with a submit button. On click of the submit button, use jQuery to call <code>post.php</code> &amp; enter the user's message into the Database. There is no trouble in this. </p> <p>Then I use the jQuery ajax method (see below) to call <code>display.php</code> and place the content returned into the chatbox div. Here's the code:</p> <pre><code>function loadLog(){ if(counter&gt;1) delaytime=2500; counter++; var oldscrollHeight = $("#chatbox").attr("scrollHeight") - 20; var id=$("#ID").val(); var _url='display.php?Id='+id; $.ajax({ url:_url, cache: false, success: function(html){ $("#chatbox").html(html); //Insert chat from DB into the #chatbox div var newscrollHeight = $("#chatbox").attr("scrollHeight") - 20; if(newscrollHeight &gt; oldscrollHeight){ $("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal'); } }, }); } </code></pre> <p>Note: this is a function which is called at interval of 2500 milliseconds- </p> <pre><code>setInterval (loadLog, delaytime); </code></pre> <p>This works fine too.</p> <p>Now, in <code>display.php</code>, I used </p> <pre><code>echo PIPHP_ReplaceSmileys($chatdisp['Msg'], 'smileys/'); </code></pre> <p>to display smileys inside the chat. The code for this is here: <a href="http://pluginphp.com/plug-in59.php" rel="nofollow">http://pluginphp.com/plug-in59.php</a></p> <p>My problem: Since we are refreshing <code>display.php</code> every 2500 milliseconds, the emoticons blink every time they are displayed. This doesn't happen with text since text is quick while images take time to load. This is less than ideal. Is there a way to prevent this blinking?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload