使用jQuery Mobile动态更改翻转切换的值 [英] Change value of flip toggle dynamically with jQuery Mobile

查看:88
本文介绍了使用jQuery Mobile动态更改翻转切换的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery Mobile,并将一些设置保存在cookie中.重新加载设置页面后,我读取了cookie以设置所有值.我在设置翻转开关时遇到麻烦.大多数元素只需要触发keyupchanged事件,但是我不确定翻转如何从选择框中获取其值.有什么想法吗?

I'm working with jQuery Mobile, and I save some settings in a cookie. When the settings page is reloaded, I read the cookie to set all the values. I'm having trouble setting the flip toggle switch. Most elements just have to trigger the keyup or changed events, but I'm not sure how the flip toggles gets its value from the select box. Any ideas?

推荐答案

更改开关的值后,必须刷新它才能使动画切换:

After you change the value of the switch you have to refresh it for the animation to toggle:

$('#Switch2').val('on').slider("refresh");

这篇关于使用jQuery Mobile动态更改翻转切换的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆