Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JQ:Click issue

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #148501
    lrelia
    Participant

    Hey,my code is wrote to show/hide the next or prev image through click issues,but sth is wrong.Can anyone help?I will be very grateful.http://codepen.io/lrelia/pen/fJzEq

    #148508
    Kuzyo
    Participant

    here my try, but I only studying JS/jQuery and there is more better solution http://codepen.io/Kuzyo/pen/GowDr

    p.s. I now in process of reading this book http://www.amazon.com/JavaScript-jQuery-The-Missing-Manual/dp/1449399029 there is several good tutorials how to work with galleries

    #148535
    lrelia
    Participant

    @Kuzyo Much Thank.Your solution works well, but I delete it by mistake..T T I write a different solution for the problem.http://codepen.io/lrelia/pen/fJzEq It works well with Chrome and IE 9,but just can’t work well in codepen.HAHA.
    The before mistake I made is click() .
    Wrong: selector.click(function() {}); //anonymous function is not allowed
    Right: var handle = function() {};selector.click(handle);

    #148541
    Kuzyo
    Participant

    click is allowed, it’s example from jQuery documentation http://api.jquery.com/click/ :

    $( "p" ).click(function() {
      $( this ).slideUp();
    });
    
    #148545
    lrelia
    Participant

    @Kuzyo,but it seems weird´╝îit doesn’t work when I use anonymous function.Is it because ‘current’ is global variable?

    #148603
    Kuzyo
    Participant

    Can you send me your full code. Interesting why it doesn’t work?

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.