javascript - Image preview overflow the browser height -
using image preview plugin, need preview automatically goes when thumbnail way bottom of screen. tried code, doesn't work well.
if((e.pagex <= $(document).width()/2) && (e.pagey <= $(document).height()*0.75)) { $("#preview") .css("top",(e.pagey - xoffset) + "px") .css("left",(e.pagex + yoffset) + "px"); } else if((e.pagex > $(document).width()/2) && (e.pagey <= $(document).height()*0.75)) { $("#preview") .css("top",(e.pagey - xoffset) + "px") .css("right",($(document).width() - e.pagex + yoffset) + "px"); } else if((e.pagex <= $(document).width()/2) && (e.pagey > $(document).height()*0.75)) { .css("bottom",($(window).height() - e.pagey + xoffset) + "px") .css("left",(e.pagex + yoffset) + "px"); } else { $("#preview") .css("bottom",($(window).height() - e.pagey + xoffset) + "px") .css("right",($(document).width() - e.pagex + yoffset) + "px"); }
Comments
Post a Comment