ScrollTop - jQuery does not scroll -
i've got code:
http://jsfiddle.net/goodghost/mer3a/
$(function() { var mywidth = $(".container").width(); var myheight = $(window).height(); console.log(myheight); var myshift = (1920 - mywidth)/2; $(".container").scrollleft(myshift); //small window $(".dragme").css({"left":myshift/10+"px", "width":(mywidth)/10+"px", "height":myheight/10+"px"}); $(".dragme").draggable({ addclasses: false, containment: "parent", drag: function(event, ui) { var offset = $(this).offset(); var xpos = offset.left; var ypos = offset.top; console.log(ypos); $(".container").scrollleft(xpos*10); $(".container").scrolltop(ypos*10+"px"); } }); });
what want achieve scroll in every direction image inside .container triggered movement of semi transparent div class dragme. know why it's working left , right, not top, bottom?
you not able use $('.container').scrolltop
if allow div grow 100% in height. need set width , height .container
, work charm.
jsfiddle: http://jsfiddle.net/mer3a/9/
Comments
Post a Comment