Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: jQuery only works on second click

  1. #1
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default jQuery only works on second click

    Hi,
    Here is a page as example but actually the same across my site
    http://www.theremotedoctor.co.uk/acc...llto=selection

    When looking through my menu on an iOS device I've noticed that making a selection only works on second click.
    Or another way to put it an odd number.
    Example.
    Select Fiat nothing happens, select Fiat again and Fiat page opens.
    Select Bmw nothing happens, select Porsche and Porsche page opens.

    This hasn't been checked on PC as I only has access to iOS device until tomorrow.
    I did make an edit to the jQuery this morning but no mater what I do I'm unable to get my two items to work.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Fine on PC, no idea what the trouble is on IOS.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I would try getting rid of the google highlight script and the animated title script.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    Fine on PC, no idea what the trouble is on IOS.
    I've just checked it on the iPad and it's ok so just iPhone at fault.
    This is the code that I've been playing with.
    Code:
    $("li:has(ul)").on({  mouseover:function() 
    { $("ul", this).slideDown(); 
     }, onmouseleave:function()
    { $("ul", this).slideUp(); 
     }
    Tomorrow I will put the original code back which will then fix this and will then explain what I'm trying to achieve etc.
    Might be easier for you then to advise as opposed to fault finding.

    Many thanks for your time.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I mention the google highlighting script because - after you fixed it, I tried it out on your site. It relies upon the document.referrer property, which is the URL of the page that sent you to (in this case) your page. In Chrome and Opera, and probably many others, the query string is stripped from that, so the information required to carry out the highlighting is not there - end result, it does nothing. Which is nowhere near as bad as what happens in IE 11 where it does get the full URL including the query string, but crashes the browser either because the page is too complex or has no valid closing tag(s) for one or more elements, or both. So, if it's a choice between not working, or crashing in most cases, I'd say it's not worth using. The animated title thing is a little less problematic. It does consume resources though, which can make a page balky, and annoying.

    So I would say regardless - get rid of the recent addition of the google highlighting script, and at least think about losing the animated title.

    I'll have a look at the code you just published to see if any thing jumps out at me there.

    OK, that was quick:

    Code:
    $("li:has(ul)").on({  mouseover:function() 
    { $("ul", this).slideDown(); 
     }, onmouseleave:function()
    { $("ul", this).slideUp(); 
     }
    is incomplete, so is either missing code that explains what it's doing, or does nothing. What file on your site is it included in? If I could see the entire file, It would be clearer to me what we are dealing with.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default

    Ok
    I don't have the old code to and until the morning.
    Let's rewind to when all was fine.
    Use this page as an example http://www.theremotedoctor.co.uk/acc...llto=selection
    Part 1
    On the right hand side is item selection,select item and its photo is loaded this is using on click.
    Part 2
    Go to Keys and Remotes,scroll down and Honda had to be clicked for the sub menu to fly out.

    I decided to change the sub menu from on click to on mouse over.
    The sub menu then worked great BUT the on click did not the load the photo for them item selection.
    I put the code back to its original state and picture loading / sub menu working correctly again but both using on click.
    I started again and it's now using the current code installed.
    PC & iPad working fine but as we know on the iPhone you need to click the option from any drop down menu twice before it will load " BMW FIAT SUZUKI" etc etc.

    My required goal is.
    Item selection loads photo using on click.
    Honda fly out sub menu using on mouse over / off mouse over.

    I say on / off mouse over so when you don't wish for Honda items but just pass over the word by going down the list FIAT FORD HONDA LAND ROVER etc etc it flies out but then hides etc as you continue down the named items after Honda, with me ?

    The complete jQuery is at the bottom of pretty much each page.

  7. #7
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    One of the likely sources of a problem with jQuery is that you are still loading two different versions of the jQuery library.

    On this page http://www.theremotedoctor.co.uk/acc...llto=selection, there's one on line 33 and another on line 388.

  8. #8
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default

    So which do do advise to edit / delete as this ain't my scene.

  9. #9
    Join Date
    Jan 2009
    Location
    NH
    Posts
    675
    Thanks
    98
    Thanked 26 Times in 26 Posts

    Default

    try to add the jquery no conflict rule on the scripts. I don't have much time to try it myself for you. Read https://api.jquery.com/jquery.noconflict/

  10. #10
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    As the call on line 33 loads an older version of jQuery, you could try commenting out that line.

Similar Threads

  1. Replies: 16
    Last Post: 07-18-2013, 12:13 PM
  2. hover only works partly with slideshow using jquery
    By WebSurfer in forum JavaScript
    Replies: 7
    Last Post: 09-22-2012, 06:51 PM
  3. Resolved jquery ui tabs doesn't make form works!
    By hosam in forum JavaScript
    Replies: 7
    Last Post: 02-14-2012, 03:31 AM
  4. Replies: 5
    Last Post: 09-09-2010, 04:39 PM
  5. Resolved jQuery code only works in Fx and Chrome
    By Snookerman in forum JavaScript
    Replies: 4
    Last Post: 12-27-2008, 09:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •