Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wrap(obj) {
- // Wraps the container if it scrolls off the screen entirely.
- var x = $(obj).offset().left;
- var y = $(obj).offset().top;
- var h = $(obj).height();
- var w = $(obj).width();
- if (y + h < 0) {
- $(obj).css('top', $(window).height() + 'px');
- } else if (w + x < 0) {
- $(obj).css('left', $(window).width() + 'px');
- } else if (x > $(window).width()) {
- $(obj).css('left', 0 - w + 'px');
- } else if (y > $(window).height()) {
- $(obj).css('top', 0 - h + 'px');
- }
- }
- function left(amount, obj) {
- // Move element left.
- $(obj).children().each(function() {
- if ($(this).children().length > 0) {
- left(amount, jQuery(this));
- } else {
- $(this).css('left', parseInt($(this).css('left')) - amount + 'px');
- wrap(this);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment