Tuesday, 15 March 2011

javascript - Jquery content's mouseover not display after contents load again -


I have created a (right) side bar to display all the new posts (like Facebook). Now if the user uses the mouse on any post, then a new box is faded to display this full post (like Facebook).

After this 5-second interval, this side bar will find all the new posts from an AJAX request. And it used the code below to display the whole post for mouseover.

  $ ("upbox1"). Mouseover (function () {var id = $ (this) .attr ('id'). Replace ('', ''); $ ($ ('.loader2'). Show (); $ .get ("uphover ? Id = "+ id, function (data) {$ ('# menu') .empty (). Html (data); $ ('. Loader2'). Hide ();});}); < Mouseover is displayed for the first time after the page is loaded, but the side post reloads only after 5 seconds, the mouseover can not display anything.  

/ P>

How to solve it?

All scripts have been placed in the same file: Mys Update Script of the Hide Bar:

  var uid = '& lt;? $? Session-> ID?? & Gt; function addside (type, msg) {// side Do something to display all the new posts in the bar} Function waitFormailno () {$ .ajax ({type: "GET", url: "updateside.php", cache: incorrect, async: false, data type: 'json' , Data: "uid =" + uid, timeout: 15000, success: work (data) {add ("midwid", data); set timeout (waitarmarm, 15000);}, error: work () {setTimeout (waitFormailno, 15000);}}); } $ (Document) .ready (function () {waitFormailno ();});  

You must use the .on () syntax : () ('mouseover', '.upbox1', function () {var id = $ (this) .attr ('id'). $ ("#"); $ ("Slow"); $ ('. Loader2'). Show (); $ .get ("uphover? Id =" + id, function (data) {$ ('# menu') empty () .html (data); $ (' Loader 2 '). Hide ();});});

You can change the body with the # sidebar (change as far as possible) if the sidebar never changes.


No comments:

Post a Comment