jquery - Does $(this) refer to the item clicked when inside a click function? -
jquery - Does $(this) refer to the item clicked when inside a click function? -
i have fiddle here multiple galleries: http://jsfiddle.net/cmscss/uh0cq4o8/
i'd buttons (next, prev , zoom) refer gallery button clicked having lot of problem understanding many answers/blogs etc this
.
i've been trying move dom actual button clicked define right gallery replacing this:
next = ($('.gallery-item.active').prev().length > 0) ?
with like:
next = ($(this).closest('.gallery').find('.gallery-item.active').prev().length > 0) ?
or using parents like:
next = ($(this).parents('.gallery').find('.gallery-item.active').prev().length > 0) ?
but i'm not exclusively sure this
supposed go.
any pointers in right direction much appreciated.
cheers
this mutual scoping issue in javascript. in particular case, yes refers button command itself. want point out can set refers when phone call function using .bind take time utilize it
jquery this
Comments
Post a Comment