Tony
Tony

Reputation: 12705

jQuery - how to exclude a DOM element from executing an animation?

I have a problem with that HTML code. The most parent div (class='question-cont') executes an animation (jQuery slideToggle()) But, I if I click on the IPSUM text, that animation is also being executed. How to exclude the div.answer-data-container from executing that animation ?

<div class='question-cont'>
    <div class='question-toggle-header'>
        <div class='left question-container'>
           <label class='label-none orange-font left'>LOREM</label>
        </div>
    </div>
    <div class='clear'></div>
    <div class='left answer-data-container slider'>
        <div class='q-text'>
            <label class='label-none left'>IPSUM</label>
        </div>
    <div class='clear'></div>

Upvotes: 0

Views: 71

Answers (1)

Can Geliş
Can Geliş

Reputation: 1474

Because IPSUM is a part of question-cont so when you click on IPSUM you also click on question-cont. Why don't you use question-toggle-header instead of question-cont to trigger the slideToggle

Upvotes: 2

Related Questions