Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screen rubbish #6

Closed
scargill opened this issue Nov 25, 2016 · 2 comments
Closed

screen rubbish #6

scargill opened this issue Nov 25, 2016 · 2 comments

Comments

@scargill
Copy link

scargill commented Nov 25, 2016

I wonder if you can help..

I'm using the vibrate as such (simplified - so I have an image rollover and touch vibrate - works WONDERFULLY


<script src="/js/jquery.vibrate.min.js"></script>

<script>
$(".lightup").vibrate("short");

function restore_icon() {
        $(this).attr('src',$(this).attr('src').replace("_b.png",".png"));
    };

$('.lightup').on('mousedown', function() {
    $(this).attr('src',$(this).attr('src').replace(".png","_b.png"));  
    setTimeout(restore_icon.bind(this),500);
    });
</script>

<div layout="row" layout-align="space-between" style="padding:0px; text-align: left; margin:2px; border:2px solid black;">
<img class="lightup" src="http://www.scargill.net/icons/timed.png" ng-click="send({payload: 'p1dn' })" height="24px"/>
</div>

However... on a NON-mobile - my text ends up totally garbled... some bracket info which should only display as "P1: 01:00 T1:16c" before the image... ends up like this..

{{"P1: "+ msg.payload.p1}} {{"T1: "+ msg.payload.t1 + "c"}}

In my example above how could I test to ensure this only happens in a mobile - or is there something else wrong - it absolutely works a treat on an android mobile..

@Illyism
Copy link
Owner

Illyism commented Nov 25, 2016

I think you're better off on using navigator.vibrate in your lightup-mousedown function. Just check if the feature is supported in the browser and then execute it.

@scargill
Copy link
Author

All that effort and it turns out to be a single line of code :-) Thank you for the advice. Tested, works.

@Illyism Illyism closed this as completed Nov 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants