3
打開彈出窗口後,想要禁用jQuery中的背景顯示模式。請看下面的fiddle。在這個小提琴中它正在工作,但它已經佔據了整個屏幕。我想把它設置爲特定的div。jquery顯示模式彈出對齊
$(function() {
$(document).foundation();
$('ul.f-dropdown li a').on('click', function (event) {
console.log('Dropdown clicked', event.target);
$('.reveal-modal').foundation('dropdown', 'closeall');
});
});
.generation .reveal-modal {
background-color: red;
}
.generation{
width:700px;
height:400px;
background:lightgreen;
}
<a href="#" data-reveal-id="myModal">Click Me For A Wonky Modal</a>
<div class='generation'>
<div id="myModal" class="reveal-modal" data-reveal>
<h2>Wonky Dropdown Dialog</h2>
<a href="#" data-dropdown="drop1">Has Dropdown</a>
<ul id="drop1" class="f-dropdown" data-dropdown-content>
<li><a href="#">This is a link</a>
</li>
<li><a href="#">This is another</a>
</li>
<li><a href="#">Yet another</a>
</li>
</ul> <a class="close-reveal-modal">×</a>
</div>
</div><!--/.generation -->
<hr/>
<a href="#" data-reveal-id="myWorkingModal">Click Me For A Working Modal</a>
<div id="myWorkingModal" class="reveal-modal" data-reveal>
<h2>Working Dropdown Dialog</h2>
<a href="#" data-dropdown="drop1">Has Dropdown</a>
<ul id="drop1" class="f-dropdown" data-dropdown-content>
<li><a href="#">This is a link</a>
</li>
<li><a href="#">This is another</a>
</li>
<li><a href="#">Yet another</a>
</li>
</ul> <a class="close-reveal-modal">×</a>
</div>
請檢查該小提琴和幫助我做到這一點的。
你能不能給我們一個工作模式? – NiZa
你有什麼背景? – Ionut
我想rgba(0,0,0,0.45)這個背景顏色,並且彈出窗口也應該只在主容器div內打開。不需要整個屏幕。 –