我有一个弹出窗口使用大胆的弹出插件(参见http://dimsemenov.com/plugins/magnific-popup/documentation.html)。弹出窗口工作正常但是当我添加animate.css(参见https://github.com/daneden/animate.css)时,我已经在一些例子中看到2是兼容的,它对我没有用。这是我的代码:
<form class="dnt-tool" name="dnt" id="dnt">
<div class="dnt-overlay">
<input type="radio" name="gender" id="male"><label for="male">Male</label>
<input type="radio" name="gender" id="female"><label for="female">Female</label>
<input type="radio" name="gender" id="all" checked><label for="all">All</label>
<select>
<option>Select a Category</option>
<option>Catgeory 1</option>
<option>Catgeory 2</option>
<option>Category 3</option>
</select>
</div><!-- end of dnt-overlay -->
<div class="dnt-btn">
<button type="submit" id="submit">Show Names</button>
</div><!-- end of dnt btn -->
</form><!-- end of dnt-tool -->
</div><!-- end of dnt-container-mobile -->
<div class="white-popup mfp-hide male-dog" id="male-modal">
<div class="popup-logo">
<a class="logo teal"></a>
</div><!-- end of logo -->
<h1>Most Popular Male <br> Dog Names</h1>
<img src="/img/dnt/male-puppy.png" alt="Male puppy">
<div class="results-list">
<ul>
<li>Abby</li>
<li>Apollo</li>
<li>Bailey</li>
<li>Bandit</li>
<li>Baxter</li>
<li>Bear</li>
<li>Beau</li>
</ul>
<ul>
<li>Blue</li>
<li>Bo</li>
<li>Beau</li>
<li>Benji</li>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
</ul>
<ul>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
<li>Benji</li>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
</ul>
</div><!-- end of results list -->
<div class="more-btn">
<button><a href="" class="">Tap to See More Names</a></button>
</div><!-- end of dnt btn -->
</div><!-- end of male popup -->
<div class="white-popup mfp-hide female-dog" id="female-modal">
<div class="popup-logo">
<a class="logo teal"></a>
</div><!-- end of logo -->
<h1>Most Popular Female <br> Dog Names</h1>
<img src="/img/dnt/femail-puppy.png" alt="Female puppy">
<div class="results-list">
<ul>
<li>Abby</li>
<li>Apollo</li>
<li>Bailey</li>
<li>Bandit</li>
<li>Baxter</li>
<li>Bear</li>
<li>Beau</li>
</ul>
<ul>
<li>Blue</li>
<li>Bo</li>
<li>Beau</li>
<li>Benji</li>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
</ul>
<ul>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
<li>Benji</li>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
</ul>
</div><!-- end of results list -->
<div class="more-btn">
<button><a href="" class="">Tap to See More Names</a></button>
</div><!-- end of dnt btn -->
</div><!-- end of female popup -->
<div class="white-popup mfp-hide all-genders" id="all-modal">
<div class="popup-logo">
<a class="logo teal"></a>
</div><!-- end of logo -->
<h1>Most Popular Dog Names</h1>
<img src="/img/dnt/gender-all.png">
<div class="results-list">
<ul>
<li>Abby</li>
<li>Apollo</li>
<li>Bailey</li>
<li>Bandit</li>
<li>Baxter</li>
<li>Bear</li>
<li>Beau</li>
</ul>
<ul>
<li>Blue</li>
<li>Bo</li>
<li>Beau</li>
<li>Benji</li>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
</ul>
<ul>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
<li>Benji</li>
<li>Benny</li>
<li>Bentley</li>
<li>Blue</li>
</ul>
</div><!-- end of results list -->
<div class="more-btn">
<button><a href="" class="">Tap to See More Names</a></button>
</div><!-- end of dnt btn -->
</div><!-- end of results popup -->
<script>
$(document).ready(function() {
$('#dnt').submit(function(e){
e.preventDefault(); // We don't need to send the form, because it all local
if($('#male').is(':checked')) { // Check if male is checked
$.magnificPopup.open({ // open pop up for male
items: {
src: '#male-modal',
type: 'inline'
}//items
});///popup open
} else if($('#female').is(':checked')) { // Check if female is checked
$.magnificPopup.open({ // open pop up for female
items: {
src: '#female-modal',
type: 'inline'
}
});///popup open
} else if($('#all').is(':checked')) { // Check if all is checked
$.magnificPopup.open({
items: {
src: '#all-modal',
type: 'inline'
}
});
}
$('.white-popup').addClass('animated slideInRight');
});///submit function
});//JQuery
我错过了什么?
答案 0 :(得分:4)
您只需将animate.css类添加到mainClass
的{{1}}道具。
- 更新 -
添加了将magnificPopup
选项设置为type
的示例。
你走了。
inline
&#13;
$('#image-button').magnificPopup({
items: {
src: 'http://placehold.it/300'
},
type: 'image',
// add your animate.css class here
mainClass: 'animated bounceIn'
});
$('#inline-button').magnificPopup({
items: {
src: '#inline-popup'
},
type: 'inline',
// add your animate.css class here
mainClass: 'animated flipInY'
});
&#13;
.white-popup {
position: relative;
background: #FFF;
padding: 20px;
width: auto;
max-width: 500px;
margin: 20px auto;
}
&#13;