javascript - jquery draggable bug when scrolling horizontally -


thing got helped here drag div if wanted scroll down/up wouldn't possible, code, won't happen:

$(function() {     $("#divname").draggable({         start: function(event) {             var content = $("#panel_content");              // if we're scrolling, don't start , cancel drag             if (event.originalevent.pagex-content.offset().left > content.innerwidth())             {                 $(this).trigger("mouseup");                 return false;             }         }     }); }); 

now, try understand how work, seems pretty logic, thought. should try offset.top , validate against content.innerheight(), right? this:

event.originalevent.pagey-content.offset().top > content.innerheight() 

thing is, i've done console.log see these values constantly, , innerheight() same (1242) doesn't matter how resize it. why happening? should using function current height of div container?

thanks.

okey solved using:

event.originalevent.pagey-content.offset().top > parent_content.innerheight() 

so entire if-block according needs is:

$(function() {     $("#sendmessage-panel-overlay").draggable({         start: function(event) {             var content = $("#panel_content");             var parent_container = $("#sendmessage-panel-overlay");              // if we're scrolling, don't start , cancel drag             if (event.originalevent.pagex-content.offset().left > content.innerwidth() ||                     event.originalevent.pagey-content.offset().top > (parent_container.innerheight() - 34))             {                                    $(this).trigger("mouseup");                 return false;             }         }     }).resizable(); });  

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -