我找到这个脚本: http://perishablepress.com/demos/slide-fade-content/ 但是这个脚本是用ajax。使用ajax加载的页面不显示jquery。如何在没有ajax的情况下获取脚本,将display:none更改为阻塞在css中。我用这个
<div id="galeria">
<a class="showSingle" target="1">Motocykle</a>
<a class="showSingle" target="2">Auta</a>
<a class="showSingle" target="3">ATV/quady</a>
<a class="showSingle" target="4">Łodzie</a>
<div id="div1" class="targetDiv" style="display: block;"></div>
<div id="div2" class="targetDiv" style="display: none;"></div>
<div id="div3" class="targetDiv" style="display: none;"></div>
</div>
<script type="text/javascript">
jQuery(function(){
jQuery('.showSingle').click(function(){
var item = $(this);
var vis = jQuery('.targetDiv:visible');
var targetItem = item.attr('target');
var target = jQuery('#div' + targetItem);
var fn = function() {
target.fadeIn('slow');
};
if (vis.length) {
if (vis[0].id == "div" + targetItem) {
fn = function() {};
}
vis.fadeOut(fn);
} else {
target.fadeIn(slow);
}
});
});
</script>
但它看起来不像这样:http://perishablepress.com/demos/slide-fade-content/
答案 0 :(得分:0)
只需将target.fadeIn(slow);
更改为target.fadeIn('slow');