Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 2
Registered: ‎05-24-2012
My Device: bold
My Carrier: wifi

cursor link problem but touch click works

Hi,

i develop an HTML5 mobile website,
i have a button  like this :

<a id="boutonsidemenu" class="menu_off"></a>

 

and i create a jquery click event :

 

var test=0;
  $('#boutonsidemenu').click(function() {
      alert(test);
    if (test==0) {
        $("#main").css("height",hauteur_menu);
        $("#main #page").animate({left: "-=270px"}, 300);
        $("#main aside").css("display","block");
        $("#main #page #boutonsidemenu").removeClass("menu_off");
        $("#main #page #boutonsidemenu").addClass("menu_on");
        test=1;
    } else {
        $("#main").css("height","");
        $("#main #page").animate({left: "+=270px"},300, function() {
            $("#main aside").css("display","none");
        });
        $("#main #page #boutonsidemenu").removeClass("menu_on");
        $("#main #page #boutonsidemenu").addClass("menu_off");        
        test=0;
    }    
 });

If i use first the cursor, the click doesn't works.
If i use first the touch, the click works and, then, strangely the cursor click works too.
have you ever been confronted with this problematic?


BlackBerry Development Advisor
Posts: 836
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: cursor link problem but touch click works

Perhaps you could include the device and software version that you are seeing this on, and what you've seen while debugging with WebInspector?

Tim Windsor
Open Source Technical Lead
New Contributor
Posts: 2
Registered: ‎05-24-2012
My Device: bold
My Carrier: wifi

Re: cursor link problem but touch click works

This i s a blackberry 9900 7.0 pack 1465.

 

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: cursor link problem but touch click works

Thats very strange.  Touch events are mapped to click events, which explains why it works when you touch the screen.

 

However I would fully expect that using the cursor should also invoke the correct logic.

 

Perhaps its a timing issue - curious if there is a jQuery page event that is dependant on a resource that hasn't been loaded yet?  Eg. the CSS definitions that you are applying to page elements during the click handler.  Are we sure they have been loaded at runtime?

 

Can we try simplifying the example?  maybe just having an alert box wrapped in a click handler - does it work for both touch and cursor click events?

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.