jquery Programming Glossary: ctop
Scroll to an element using jQuery http://stackoverflow.com/questions/4217962/scroll-to-an-element-using-jquery version jQuery.fn.scrollMinimal function smooth var cTop this.offset .top var cHeight this.outerHeight true var windowTop.. window .scrollTop var visibleHeight window .height if cTop windowTop if smooth 'body' .animate 'scrollTop' cTop 'slow'.. if cTop windowTop if smooth 'body' .animate 'scrollTop' cTop 'slow' 'swing' else window .scrollTop cTop else if cTop cHeight..
jQuery droppable and scrollable divs http://stackoverflow.com/questions/4908010/jquery-droppable-and-scrollable-divs state hover accept #draggable drop function event ui var cTop this .closest .box .position .top parseInt this .closest .box.. .top parseInt this .css margin top this .height if dBtm cTop dTop cBtm alert Dropped. Example http jsfiddle.net lthibodeaux..
Scroll to an element using jQuery http://stackoverflow.com/questions/4217962/scroll-to-an-element-using-jquery to show version that worked for the OP as well as a smoother version jQuery.fn.scrollMinimal function smooth var cTop this.offset .top var cHeight this.outerHeight true var windowTop window .scrollTop var visibleHeight window .height if cTop.. this.offset .top var cHeight this.outerHeight true var windowTop window .scrollTop var visibleHeight window .height if cTop windowTop if smooth 'body' .animate 'scrollTop' cTop 'slow' 'swing' else window .scrollTop cTop else if cTop cHeight windowTop.. windowTop window .scrollTop var visibleHeight window .height if cTop windowTop if smooth 'body' .animate 'scrollTop' cTop 'slow' 'swing' else window .scrollTop cTop else if cTop cHeight windowTop visibleHeight if smooth 'body' .animate 'scrollTop'..
jQuery droppable and scrollable divs http://stackoverflow.com/questions/4908010/jquery-droppable-and-scrollable-divs '.item' .droppable activeClass ui state default hoverClass ui state hover accept #draggable drop function event ui var cTop this .closest .box .position .top parseInt this .closest .box .css margin top var cBtm this .closest .box .position .top.. .top parseInt this .css margin top var dBtm this .position .top parseInt this .css margin top this .height if dBtm cTop dTop cBtm alert Dropped. Example http jsfiddle.net lthibodeaux 2p56Y 6 I realize it's not elegant but it seems workable...
|