Emulate a callback to the jQuery offset function? -


I am creating a DIV status using the jQuery offset () function. In order to avoid having a DIV flash in the wrong position, I am hiding the div before the situation and then showing the DIV again. However, there is a synchronization problem and I can still see the flash on some platforms (like an iPhone). What is the best way to emulate the callback function for the offset () function?

  $ ('div'). Hide (); Y = Math (($ (Window). Light () - $ ('div'). Outer hat ()) / 2); $ ('Div') offset ({top: y}); $ ('Div') fadein () .; Besides,  Edit   

In addition, it is important that this element is still visible if Javascript is disabled.

You can access your & lt; Div & gt; The element can out-out from the viewport outside the viewport, then before proceeding to hide it again and set it offset and fade it off:

CSS:
  .outout-viewport {status: absolute; Left: -10000 pixels; }   

javascript:
  var $ div = $ ("div.outside-viewport"); $ DivCss ({status: "relative", left: "0px"}). Hide (). Offset ({top: ($ (window) .hit () - $ div.outerHeight ()) / 2}). Fade ();    

Comments