Javascript jQuery移动滑块根据其值触发不同的事件
快速提问。 我使用带有垂直滑块插件()的jqmobile 1.2.0版 如何根据其值启动某些函数。 例如,值为50时,更改其他地方的类名,值为100时,将页面重定向到新URL 之后我会做一些样本页。 这是样品 jsfiddle.net/nori2tae/zT2ZH/Javascript jQuery移动滑块根据其值触发不同的事件,javascript,android,jquery,iphone,jquery-mobile,Javascript,Android,Jquery,Iphone,Jquery Mobile,快速提问。 我使用带有垂直滑块插件()的jqmobile 1.2.0版 如何根据其值启动某些函数。 例如,值为50时,更改其他地方的类名,值为100时,将页面重定向到新URL 之后我会做一些样本页。 这是样品 jsfiddle.net/nori2tae/zT2ZH/ 谢谢。我想这就是你需要的 function anotherfunction() { alert('another function is fired'); } $(document).ready(function() {
谢谢。我想这就是你需要的
function anotherfunction() {
alert('another function is fired');
}
$(document).ready(function() {
//do something
$('.container').change(function() {
if ($(this).children('input').val()==50) {
$('.changeThis').addClass('changed');
$('.changed').removeClass('changeThis');
alert("at 50 and changeThis now have [" + $('.changed').attr("class") + "] classes");
} else if($(this).children('input').val()==100) {
// another function here
anotherfunction();
}
});
});
jsfiddle:
您也可以在移动调试模式下尝试..Thanx很多!我要试试这个并在我的项目上实施。让你知道它是如何很快出来的!很抱歉反应太晚。您提供的代码在我的项目中运行良好。再次感谢:)