Live Demo: Untitled Document
Someone on these forums modified my script, I believe to be the one below, however I cannot find logs of the thread I made, so that the main content (with the Lorem ipsum) cannot scroll out of view upon reaching the bottom as well as the side menu.
If you go to my live version and scroll the main content area to the bottom, this should be the maximum scroll position. If you click on the last option of the menu, it allows you to scroll to the bottom and no further however I seem to have broken this script and the content is now scrolling out of view.
It may be that I've done something simple or not so, either way I've done something stupid and cannot find anything which tells the .Main to stop when it hits the bottom making it fixed and scrolling back up to become fixed when it reaches the top along side the side nav...
Code:!function(i) { var scrollY = 0; $(window).scroll(function() { var s = $(".SideNav"), o = $(this).scrollTop(), t = $(window).height() - 42; if ($(".Menu").hasClass("Closed")) { var e = SideBarExpanded + SideBarExpandedOffset; if (e > t) { var f = e - t; if (o > scrollY) o >= f && s.css({ top: 42 - f + o }), 42 >= o && s.css({ top: 42 }); else { var l; l = s.offset().top < 0 ? Math.pow(s.offset().top) : s.offset().top, l > 42 + o && s.css({ top: 42 + o }) } } else s.css({ top: 42 + o }) } else { var e = s.height(); if (s.height() > t) { var f = s.height() - t; if (o > scrollY) o >= f && s.css({ top: 42 - f + o }), 42 >= o && s.css({ top: 42 }); else { var l; l = s.offset().top < 0 ? Math.pow(s.offset().top) : s.offset().top, l > 42 + o && s.css({ top: 42 + o }) } } else s.css({ top: 42 + o }) } scrollY = o }); i.fn.extend({ accordion: function() { return this.each(function() { function i(i, e) { if (!$(".Menu").hasClass("Closed") || $(".Menu").hasClass("Closed") && !$(this).find(".sub-menu").hasClass("first")) e || $(i).toggleClass("Active").parent("li").siblings().find("a").removeClass("Active").parent("li").children("ul").slideUp("fast"), $(i).siblings().slideToggle("fast", function() { SideBarHeight = $(".SideNav").height(), PageHeight = $(window).height(), SideBarExpanded = $(this).height(), SideBarExpandedOffset = $(this).offset().top, SideBarHeight < PageHeight ? $(".Wrapper").css({ height: PageHeight - 42 + "px" }) : $(".Wrapper").css({ height: SideBarHeight + "px" }) }); else { e || $(i).toggleClass("Active").parent("li").siblings().find("a").removeClass("Active").parent("li").children("ul").slideUp("fast"); $(i).siblings().css({ display: "block" }) } } var e = $(this); if (e.data("accordiated")) return !1; $.each(e.find("ul"), function() { $(this).data("accordiated", !0), $(this).hide() }), $.each(e.find("a"), function() { $(this).click(function(e) { return void i(this) }) }); var s = $(".Active"); s && (i(s, "toggle"), $(s).parents().show()) }) } }) }(jQuery);




Reply With Quote
