Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery Mobile: how to not display the button focus halo when a button is clicked?

I have buttons in my web app using jQuery Mobile.

When clicked the buttons have the ui-focus class added which displays a blue halo around buttons. The class stays there until another spot on the page is clicked. This happens in firefox, not iPad. I would like that this halo is not displayed.

What must I do for that focus halo not to be displayed at all ?

like image 394
chmike Avatar asked Dec 21 '22 21:12

chmike


2 Answers

You can override the default css instead of hacking up the source. Just make sure your css file is after the JQM one.

.ui-focus,
.ui-btn:focus {
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none ;
}
like image 106
codaniel Avatar answered May 17 '23 22:05

codaniel


I have found that the best way to do this is to give focus back to the page after your buttons are clicked.

$('yourButtons').click(function(){
    //Do some important stuff
    // ....

    $.mobile.activePage.focus();
});
like image 24
TheGwa Avatar answered May 18 '23 00:05

TheGwa