Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 加载页面时,页面将显示所有内容。我希望它显示item1的内容_Jquery - Fatal编程技术网

Jquery 加载页面时,页面将显示所有内容。我希望它显示item1的内容

Jquery 加载页面时,页面将显示所有内容。我希望它显示item1的内容,jquery,Jquery,第一个选项卡的内容 //isotope filter jQuery(document).ready(function() { var $container = $('.isotope-filter'); $container.isotope({ itemSelector : '.single-isotope-filter' }); //relayout setInterval(func

第一个选项卡的内容

//isotope filter
    jQuery(document).ready(function() {

        var $container = $('.isotope-filter');

        $container.isotope({
        itemSelector : '.single-isotope-filter'
        });

        //relayout 
        setInterval(function(){
            $container.isotope('reLayout');
        }, 0);
        //reLayout


        var $optionSets = $('#options .option-set'),
          $optionLinks = $optionSets.find('a');

        $optionLinks.click(function(){
        var $this = $(this);
        // don't proceed if already selected
        if ( $this.hasClass('selected') ) {
          return false;
        }
        var $optionSet = $this.parents('.option-set');
        $optionSet.find('.selected').removeClass('selected');
        $this.addClass('selected');

        // make option object dynamically, i.e. { filter: '.my-filter-class' }
        var options = {},
            key = $optionSet.attr('data-option-key'),
            value = $this.attr('data-option-value');
        // parse 'false' as false boolean
        value = value === 'false' ? false : value;
        options[ key ] = value;
        if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
          // changes in layout modes need extra logic
          changeLayoutMode( $this, options )
        } else {
          // otherwise, apply new options
          $container.isotope( options );
        }

        return false;
        });

    });
    //end isotope filter
内容
第二个选项卡的内容

<div class="single-isotope-filter filterone">content</div>
内容
第三个选项卡的内容

<div class="single-isotope-filter filtertwo">content</div>
内容

当我加载页面时,将显示所有三个内容。我希望它在加载页面时只显示item1内容。有人能帮忙吗。

也许你正在寻找类似的东西?您只需将其放在$(document).ready()函数下即可。(非JQuery版本)


在这些方法中,有各种各样的方法可以做到这一点。

您尝试过使用Visibility吗谢谢您的回复。我尝试了你的方法,但内容是隐藏的,但如果我单击其他选项卡,它们将不会显示各自的内容。这里是参考链接
<div class="single-isotope-filter filterthree">content</div>
var divs = document.getElementsByClassName('single-isotope-filter');
for (var i=1; i<divs.length; i++) {
    divs[i].style.visibility = 'hidden';
}
div.filtertwo,div.filterthree {
    visibility: hidden;
}