{"comment":{"created_at":"2011-10-21T16:02:10Z","body":"We had another problem with unset height for the container div.  The scrollable div was always to a negative marginTop value.\r\nWe've had a new option to push a custom function for getting the parent height.  In our case, we've created a function to compute the height of the dynamic container div.\r\nThis is the new version\r\n\r\n```javascript\r\n(function ($) {\r\n\r\n    // Public: jScroll Plugin\r\n    $.fn.jScroll = function (options) {\r\n\r\n        var opts = $.extend({}, $.fn.jScroll.defaults, options);\r\n\r\n        return this.each(function () {\r\n            var $element = $(this);\r\n            var $window = $(window);\r\n            var locator = new location($element);\r\n\r\n            $window.scroll(function () {\r\n                $element\r\n\t\t\t\t\t.stop()\r\n\t\t\t\t\t.animate(locator.getMargin($window), opts.speed);\r\n            });\r\n        });\r\n\r\n        // Private \r\n        function location($element) {\r\n            this.min = $element.offset().top;\r\n            this.originalMargin = parseInt($element.css(\"margin-top\"), 10) || 0;\r\n\r\n            this.getMargin = function ($window) {\r\n                var max = opts.getParentHeight() - $element.outerHeight(); // CHANGED\r\n                var margin = this.originalMargin;\r\n\r\n                if ($window.scrollTop() >= this.min)\r\n                    margin = margin + opts.top + $window.scrollTop() - this.min;\r\n\r\n                if (margin > max)\r\n                    margin = max;\r\n\r\n                return ({ \"marginTop\": margin + 'px' });\r\n            }\r\n        }\r\n\r\n    };\r\n\r\n    // Public: Default values\r\n    $.fn.jScroll.defaults = {\r\n        speed: \"slow\",\r\n        top: 10,\r\n        getParentHeight: function () { $element.parent().height(); } // ADDED\r\n    };\r\n\r\n})(jQuery);\r\n","updated_at":"2011-10-21T16:02:10Z","url":"https://api.github.com/repos/wduffy/jScroll/issues/comments/2482985","id":2482985,"user":{"gravatar_id":"abd81e818ce0ccbe5cbe2a02adc45653","avatar_url":"https://secure.gravatar.com/avatar/abd81e818ce0ccbe5cbe2a02adc45653?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jesuissur","id":136296,"login":"jesuissur"}},"action":"created","issue":{"number":3,"created_at":"2011-08-25T12:10:10Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"Browser in Question: FF v 3.5.4, Safari v 5.0.1, Opera v 11.5\r\nOS: Mac OS X 10.5.8\r\n\r\nIssue:\r\n\r\nIn the event that the container div does not have a height set in css the plugin will currently scroll the scrollable div down infinitely by expanding the container div infinitely. Is there a way to keep the scrollable div from expanding the containing div, or maybe including some settings so that we can eliminate the expansion by setting {container_expansion: false}?\r\n\r\nThis is a dynamically built site so the divs for both the scrolling div and the container div have variable heights depending on the page displayed. If you need an example just message me and I can send you a link.\r\n \r\nChrome v 13.0.782.215 does not seem to have this issue","comments":2,"title":"unset height of div : possible bug","updated_at":"2011-10-21T16:02:10Z","url":"https://api.github.com/repos/wduffy/jScroll/issues/3","id":1482119,"assignee":null,"milestone":null,"closed_at":null,"user":{"gravatar_id":"6162e2b5062ce87a75a32c05d55bca55","avatar_url":"https://secure.gravatar.com/avatar/6162e2b5062ce87a75a32c05d55bca55?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/brycepelletier","id":1003938,"login":"brycepelletier"},"html_url":"https://github.com/wduffy/jScroll/issues/3","labels":[],"state":"open"},"legacy":{"issue_id":1482119,"comment_id":2482985}}