开发者

click on div: do this, click on link inside div: do something else

i have some div element that scrolls to another position, when you click on it. but now i also want to include links into that div.. now when i click, the link gets called plus the div scrolls. i want to prevent the div from scrolling, when hitting a href..

any idea?

jsfiddle (this example is n开发者_Python百科ot scrolling at all, but i want it to alert the href, when click on an href element, or stay undefinded, when no href element is around..)


It looks like you need two onclicks, one on the div, one on the a in the div. Something like this, perhaps? http://jsfiddle.net/HfYmv/8/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜