2

I have be working on a vertical jquery scroll and i am pretty close now but it seems to be scrolling the wrong way and i really haven't got a clue why.

can someone please help here is the link.

http://dropp.users35.interdns.co.uk/scroll/

Thanks

2
  • What happens if you change ui.value / 100 * ( scrollPane.height() - scrollContent.height() ) to ui.value / 100 * ( scrollPane.height() + scrollContent.height() ) (note changing the minus sign to a plus sign)? Commented Aug 17, 2011 at 14:02
  • Got it, but, wait a moment.... why to answer you? YOU HAVE 26 [!] UNACCEPTED ANSWERS. "Wake up Dorothy!" Commented Aug 17, 2011 at 14:18

1 Answer 1

7

Try this, I tested it on my end it is working fine

Working demo

$(function () {
    var scrollPane = $(".slider_container");
    var scrollContent = $(".scroll-content");

    // Slider

    $('#slider').slider({
        orientation: "vertical",
        value: 100,
        slide: function (event, ui) {
            console.log(ui.value);
            console.log(scrollPane.height());

            if (scrollContent.height() > scrollPane.height()) {
                scrollContent.css("margin-top", (-1 * (scrollPane.height() - ((scrollPane.height() * ui.value) / 100))) + "px");

            } else {
                scrollContent.css("margin-top", 0);
            }
        }
    });
});
Sign up to request clarification or add additional context in comments.

3 Comments

Legend thanks dont know how you got it to work in jsfiddle i was trying for ages aswell so thanks for that
YOU HAVE 26 [!] UNACCEPTED ANSWERS, how can you expect to get any further help?
+1 for providing a jsFiddle link since the original example the OP made is down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.