farbtastic插件回调函数
我只是设置一个带有颜色选择器的网页。 我选择了farbtastic。
我的问题是,回调函数不起作用。 这是我使用的代码:
$('#colorPicker1').farbtastic('#background-color', function callback() {
/*commands*/
});
当用户选择颜色时,不会调用回调函数。
怎么解决这个问题呢?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我知道你的帖子很旧,但以防万一:
Your post is old I know but just in case :
像您一样调用的farbtastic
等待仅一个可选参数。 这可以是 DOM 节点、jQuery 对象、jQuery 选择器或函数。 所以你应该调用如下所示的函数
如果你想使用#background-color元素,你应该在回调主体中使用它
farbtastic called like you did
awaits only one optional argument. This can be a DOM Node, jQuery object, jQuery selector or a function. So you should call the function as shown below
If you want to use #background-color element, you should use it in the callbacks body
在做了一些搜索后,我什么也没得到,在你的问题近一年后,我认为除了手动编码之外别无选择。
在稍微修改了一下 farbtastic 和 colorpicker jquery 插件:
After doing some search at comes with nothing I after almost 1 years from your question I think that there is no option but manually coding it.
I come with this solution after hacking a little bit farbtastic and colorpicker jquery plugins: