Buttons behavior between PC and Touch devices
Basically I am a web designer and I don't know much about jQuery so I'm a little bit lost. I wrote some jQuery scripts to manage buttons but they don't have the behavior as I would like on PC and on Touch devices.
I have two families of buttons to manage. The "images" buttons (swap) and the CSS buttons (background color change).
I would like to disable the "hover" effect on Touch devices because it's mismanaged but keep the mouse clicks on Touch devices AND PC. But the drama is there.
Here is a model that I created: Model
Here is the mess I wrote:
- // Rollover on image
- $(function() {
- $('img.rollover').on('mouseenter', function() {
- $(this).css("cursor", "pointer");
- this.src = this.src.replace("-normal", "-hover");
- });
- $('img.rollover').on('mouseleave', function() {
- this.src = this.src.replace("-hover", "-normal");
- });
- });
- // Toggles forms
- $(function() {
- $("#form-contact").hide();
- $("#form-devis").hide();
- $("#btn-contact").click(function() {
- $(this).toggleClass("btn-form-hover");
- $("#form-contact").fadeToggle(500, "linear");
- $("#form-devis").hide();
- $("#btn-devis").removeClass("btn-form-hover");
- });
- $("#btn-devis").click(function() {
- $(this).toggleClass("btn-form-hover");
- $("#form-devis").fadeToggle(500, "linear");
- $("#form-contact").hide();
- $("#btn-contact").removeClass("btn-form-hover");
- });
- });
- // Toggle client area
- $(function() {
- $("#div-client-area").hide();
- $("#btn-clients").click(function() {
- $("#div-home").toggle(500, "linear");
- $("#div-client-area").toggle(500, "linear");
- });
- });