Reputation: 3179
Quick question. I use jqmobile ver.1.2.0 with vertical slider plugin(http://www.elmundio.net/blog/jquery-mobile-vertical-slider/).
How do I launch some functions depending on its value. Ex. at value 50, change somewhere else's class name, at value 100 redirect the page to new URL.
I am gonna make some sample page afterwards. Here's sample.
jsfiddle.net/nori2tae/zT2ZH/
Thanks.
Upvotes: 2
Views: 411
Reputation: 7335
i guess this is what you need
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: http://jsfiddle.net/BerkerYuceer/5ZHue/
you can also try in mobile debugging mode..
Upvotes: 1