简体   繁体   English

iOS Spinning Wheel HTML5

[英]iOS Spinning Wheel HTML5

I'm working on a webapp that will be used on iOS devices as well as Desktops (without touch). 我正在开发一个将在iOS设备和桌面上使用的webapp(没有触摸)。 We are using a bootstrap to make the site as responsive as possible. 我们使用引导程序使网站尽可能响应。

We want to incoperate the spinning wheel known in iOS. 我们想要加入iOS中已知的纺车。 We will style it differently but not the functionality. 我们将以不同的方式设计它,但不是功能。

纺车

After some searching I came across this site: http://cubiq.org/spinning-wheel 经过一番搜索,我发现了这个网站: http//cubiq.org/spinning-wheel

However this script only seems to work on touch capable devices. 但是,此脚本似乎只适用于支持触摸的设备。 Would it be possible to edit the script so it will work on desktops too? 是否可以编辑脚本以便它也适用于桌面?

I found this in the script can I add a mouseClickHandler here? 我在脚本中发现这个可以在这里添加一个mouseClickHandler吗?

handleEvent: function (e) {
        console.log(e.type);
        if (e.type == 'touchstart') {
            this.lockScreen(e);
            if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
                this.tapDown(e);
            } else if (e.currentTarget.id == 'sw-frame') {
                this.scrollStart(e);
            }
        } else if (e.type == 'touchmove') {
            this.lockScreen(e);

            if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
                this.tapCancel(e);
            } else if (e.currentTarget.id == 'sw-frame') {
                this.scrollMove(e);
            }
        } else if (e.type == 'touchend') {
            if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
                this.tapUp(e);
            } else if (e.currentTarget.id == 'sw-frame') {
                this.scrollEnd(e);
            }
        } else if (e.type == 'webkitTransitionEnd') {
            if (e.target.id == 'sw-wrapper') {
                this.destroy();
            } else {
                this.backWithinBoundaries(e);
            }
        } else if (e.type == 'orientationchange') {
            this.onOrientationChange(e);
        } else if (e.type == 'scroll') {
            this.onScroll(e);
        }
    },

You could try using drag events, but they aren't supported well. 您可以尝试使用drag事件,但它们不受支持。 Check out this MDN article and this one with more explanation on the events. 看看这个MDN文章这一个对事件的更多解释。 You could also try using jQuery with for instance this plugin . 您也可以尝试使用jQuery,例如此插件 Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM