开发者

New to JQuery - Can't get a slider to show

开发者 https://www.devze.com 2023-01-13 04:59 出处:网络
I\'m new to JQuery and want to us开发者_StackOverflow中文版e it to display a simple volume slider.

I'm new to JQuery and want to us开发者_StackOverflow中文版e it to display a simple volume slider.

Can someone please point out my mistake?

Below is a minimal test code. In case it matters, I'm using the JQuery v1.4.1 that comes with MVC2

Sample code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>
        Multimedia
    </title>
    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#volume").slider({
                orientation: "vertical",
                range: "min",
                min: 0,
                max: 100,
                step: 5,
                slide: function (event, ui) {
                    //do something;
                }
            });
        });

    </script>
</head>
<body>
    <div id="volume"></div>
</body>
</html>

This gives me the following error:

Error: $("#volume").slider is not a function
Source File: file:///c:/sample.html
Line: 15

It's worth noting that I can set the contents of #volume using .html and similar technique so it can find the element - just not the slider() function

I'm testing in FF 3.6

Thanks in advance for any help


You need to include the jQuery UI JS file.

Go to the downloads page and deselect everything, then select the slider. Doing that will also automatically select the sliders dependencies. You can also choose a theme if you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消