jQueryMobile滑块更改事件

jQueryMobile滑块更改事件,jquery,triggers,slider,Jquery,Triggers,Slider,我很难收听jQueryMobile滑块的更改事件。 在此页面中,事件会正确触发事件“slidestop”: 我的页面中相同的代码不会触发任何东西: 你能看出这段代码有什么问题吗 <html> <head> <title>My Page</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link

我很难收听jQueryMobile滑块的更改事件。

在此页面中,事件会正确触发事件“slidestop”:

我的页面中相同的代码不会触发任何东西:


你能看出这段代码有什么问题吗

<html>
<head> 
    <title>My Page</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head> 
<body> 

<div data-role="page">

    <div data-role="header">
        <h1>My Title</h1>
    </div><!-- /header -->

    <div data-role="content">    
        <label for="slider-step">Input slider:</label>
        <input type="range" name="slider-step" id="slider-step" value="150" min="0" max="500" />      
    </div><!-- /content -->

</div><!-- /page -->
<script>$("#slider-step").on("slidestop", function(e){ alert("STOP!"); });</script>

</body>
</html>

我的页面
我的头衔
输入滑块:
$(“#滑块步长”)。在(“滑块顶端”,函数(e){alert(“STOP!”;})上;

您的JSFIDLE加载如下:

//<![CDATA[ 
$(window).load(function(){
$("#slider-step").on("slidestop", function(e){
   alert("STOP!"); 
});
});//]]>     
//
您只需在页面上复制脚本,而不使用$(window).load或$(document).ready

您的JSFIDLE加载如下:

//<![CDATA[ 
$(window).load(function(){
$("#slider-step").on("slidestop", function(e){
   alert("STOP!"); 
});
});//]]>     
//
您只需在页面上复制脚本,而不使用$(window).load或$(document).ready