我有一个css网格布局,如下所示

当单击一个框时,它的高度会增加,以显示有关服务的信息。我希望能做的是“中继”网格,所以网格围绕着最高的项目?相反,我所拥有的是,当我的一件物品生长在那一行时,它的孩子也随之成长。
我所希望的是,如果点击了报告写作,它会增长并占据基准空间,基准测试会向左移动,咨询公司会换一条新的路线?
我使用的是顺风,所以我的HTML看起来像这样,
<div class="grid grid-cols-4 gap-4 services">
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-12.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Report Writing</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC can provide reports on any activity for organisations wishing to change any aspect of its operation or strategic direction. David has written consultancy reports for many countries on library and information transformation projects, various institutions seeking to gain taught degree awarding powers (TDAP), leadership and management benchmarking exercises and organisational training provision.
Notable recent examples include three reports written for for SCONUL to assess the strategic role of libraries and their leaders from the viewpoint of the universities’ senior management. This resulted in a publication for the commissioning body SCONUL to highlight the expectations of university leadership in the development of relevant library strategies. As a further phase of this work, Alison Allden and David Baker looked at the opportunities and transferable skills relating to international movement amongst library leaders.
David has been working with the University of London since March 2020 to develop a new strategy for Senate House Library, along with the School of Advanced Study, Federal Member Institute Libraries and the University of London Worldwide. The initial report was accepted by the University in September 2020. In the light of this, David has created a major Library Transformation Programme (LTP). The work involved in developing and operationalising the report included surveys, benchmarking, focus groups and workshops.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="/wp-content/uploads/2022/01/image-11.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Mentoring</h2>
<div class="mb-2 text-primary overflow-hidden service-details">David has experience of mentoring professionals from different sectors and academics reaching back to 1990. He is currently heavily involved in mentoring for CILIP Chartership, Certification and Fellowship status (the UK’s library and information association). The focus is on developing and nurturing staff while learning new ideas and approaches from other professionals. Mentoring can be undertaken in person, by email, by telephone or through online platforms.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="/wp-content/uploads/2022/01/image-10.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Workshops</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC has a wealth of experience in delivering face-to-face and online workshops for a range of projects and purposes. These can be for the purpose of stakeholder engagement, data gathering or as part of a communications strategy. Workshops, interviews and focus groups are carried out consistently and coherently to give maximum value of data and information gathered. This is done through agreed pro forma and protocols.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="/wp-content/uploads/2022/01/image-9.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Training</h2>
<div class="mb-2 text-primary overflow-hidden service-details">The DBC team can offer project management and change management training using previous live (anonymised) projects. A DBC Associate is PRINCE2 trained.
David Baker has delivered training in library management and information systems for senior leaders, library tecnhnicians and assistants for many countries of the world including, Slovenia, Ireland, Kuwait, Hungary, Germany and Portugal and has published several training guides, including on the subject of co-operative training in this area. He has also provided training and development for third world countries such as Ethiopia and Nigeria and has published a book on this.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="/wp-content/uploads/2022/01/image-8.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Benchmarking</h2>
<div class="mb-2 text-primary overflow-hidden service-details">In 2022, DBC is undertaking a major international benchmarking exercise based on the Association of Commonwealth Universities (ACU) model. It is being led by David, Caroline (Librarian of the University of Queensland for academic and research libraries in the Australia and South Pacific region), Cliff and Lucy. The title is "Benchmarking Library, Information And Education Services: New Strategic Choices In Challenging Times". An Elsevier book publication bearing the same title will be published in early 2023. The benchmarking model can be adapted for any organisational purpose.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="/wp-content/uploads/2022/01/image-7.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Research Services</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC Associates worked in 2021 on a scoping study commissioned by Research Libraries UK (RLUK) and funded by the Arts and Humanities Research Council (AHRC). It resulted in a wealth of evidence of the role and potential of research libraries as partners and leaders of research, contributing to longer-term strategic development in the process. A range of research techniques were used for this and other consultancies such as surveys, benchmarking, focus groups and workshops. Two senior associates have research backgrounds and PhDs and the Director, Professor, has a substantial and significant track record in research and publishing.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="/wp-content/uploads/2022/01/image-6.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Organisation Development</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC has been developing strategic plans at organisational and pan-organisational levels for many years, not least through working in chief executive and governance roles as well as high-level consultancy work. We are accustomed to working with governing bodies, steering committees, task forces and other groupings to shape strategic direction and effect major organisational change as a result.
Our biographical details demonstrate that we have developed, written and implemented many strategic plans, including for the Higher Education Statistics Agency (HESA) and the Joint Information Systems Committee (Jisc), as well as contributing to strategy development for the Society of College, National and University Libraries (SCONUL) and Research Libraries UK (RLUK).</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="/wp-content/uploads/2022/01/image-5.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Consultancy</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC delivers high-quality consultancy projects in higher education both nationally and internationally, with a long-standing track record, especially in strategy development. Associates have a broad and deep knowledge of the field.</div>
</div>
</div>下面是我当前解决方案的码页
发布于 2022-01-21 17:51:05
几件事。
通过设置grid-row: span 2,可以使单击的项跨越两行,这将产生“推送”其他网格项的效果。
在JS中,您调用了remove,我认为它应该是removeClass
这里有一个(有点凌乱的)代码段,它是从您的代码库创建的:
<head>
<meta charset="UTF-8">
<link rel="apple-touch-icon" type="image/png" href="https://cpwebassets.codepen.io/assets/favicon/apple-touch-icon-5ae1a0698dcc2402e9712f7d01ed509a57814f994c660df9f7a952f3060705ee.png">
<meta name="apple-mobile-web-app-title" content="CodePen">
<link rel="shortcut icon" type="image/x-icon" href="https://cpwebassets.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico">
<link rel="mask-icon" type="image/x-icon" href="https://cpwebassets.codepen.io/assets/favicon/logo-pin-8f3771b1072e3c38bd662872f6b673a722f4b3ca2421637d5596661b4e2132cc.svg" color="#111">
<head>
<title>CodePen - A Pen by Simon Ainley</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css">
<style>
.service-details {
overflow: hidden;
max-height: 0;
transition: max-height 0.5s cubic-bezier(0, 1, 0, 1);
}
.service-details.service-content-visible {
max-height: 300px;
grid-row: span 2;
transition: max-height 1s ease-in-out;
}
</style>
<script>
window.console = window.console || function(t) {};
</script>
<script>
if (document.location.search.match(/type=embed/gi)) {
window.parent.postMessage("resize", "*");
}
</script>
<style>
.service-details {
overflow: hidden;
max-height: 0;
transition: max-height 0.5s cubic-bezier(0, 1, 0, 1);
}
.service-details.service-content-visible {
max-height: 300px;
transition: max-height 1s ease-in-out;
}
</style>
</head>
<div class="grid grid-cols-4 gap-4 services">
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-12.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Report Writing</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC can provide reports on any activity for organisations wishing to change any aspect of its operation or strategic direction. David Baker has written consultancy reports for many countries on library and information transformation projects, various
institutions seeking to gain taught degree awarding powers (TDAP), leadership and management benchmarking exercises and organisational training provision. Notable recent examples include three reports written for for SCONUL to assess the strategic
role of libraries and their leaders from the viewpoint of the universities’ senior management. This resulted in a publication for the commissioning body SCONUL to highlight the expectations of university leadership in the development of relevant
library strategies. As a further phase of this work, Alison Allden and David Baker looked at the opportunities and transferable skills relating to international movement amongst library leaders. David Baker has been working with the University
of London since March 2020 to develop a new strategy for Senate House Library, along with the School of Advanced Study, Federal Member Institute Libraries and the University of London Worldwide. The initial report was accepted by the University
in September 2020. In the light of this, David has created a major Library Transformation Programme (LTP). The work involved in developing and operationalising the report included surveys, benchmarking, focus groups and workshops.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-11.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Mentoring</h2>
<div class="mb-2 text-primary overflow-hidden service-details">Professor David Baker has experience of mentoring professionals from different sectors and academics reaching back to 1990. He is currently heavily involved in mentoring for CILIP Chartership, Certification and Fellowship status (the UK’s library
and information association). The focus is on developing and nurturing staff while learning new ideas and approaches from other professionals. Mentoring can be undertaken in person, by email, by telephone or through online platforms.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-10.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Workshops</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC has a wealth of experience in delivering face-to-face and online workshops for a range of projects and purposes. These can be for the purpose of stakeholder engagement, data gathering or as part of a communications strategy. Workshops, interviews
and focus groups are carried out consistently and coherently to give maximum value of data and information gathered. This is done through agreed pro forma and protocols.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-9.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Training</h2>
<div class="mb-2 text-primary overflow-hidden service-details">The DBC team can offer project management and change management training using previous live (anonymised) projects. A DBC Associate is PRINCE2 trained. David Baker has delivered training in library management and information systems for senior leaders,
library tecnhnicians and assistants for many countries of the world including, Slovenia, Ireland, Kuwait, Hungary, Germany and Portugal and has published several training guides, including on the subject of co-operative training in this area.
He has also provided training and development for third world countries such as Ethiopia and Nigeria and has published a book on this.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-8.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Benchmarking</h2>
<div class="mb-2 text-primary overflow-hidden service-details">In 2022, DBC is undertaking a major international benchmarking exercise based on the Association of Commonwealth Universities (ACU) model. It is being led by David Baker, Caroline Williams (Librarian of the University of Queensland for academic
and research libraries in the Australia and South Pacific region), Cliff Wragg and Lucy Ellis. The title is "Benchmarking Library, Information And Education Services: New Strategic Choices In Challenging Times". An Elsevier book publication bearing
the same title will be published in early 2023. The benchmarking model can be adapted for any organisational purpose.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-7.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Research Services</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC Associates worked in 2021 on a scoping study commissioned by Research Libraries UK (RLUK) and funded by the Arts and Humanities Research Council (AHRC). It resulted in a wealth of evidence of the role and potential of research libraries as partners
and leaders of research, contributing to longer-term strategic development in the process. A range of research techniques were used for this and other consultancies such as surveys, benchmarking, focus groups and workshops. Two senior associates
have research backgrounds and PhDs and the Director, Professor Baker, has a substantial and significant track record in research and publishing.</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-6.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Organisation Development</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC has been developing strategic plans at organisational and pan-organisational levels for many years, not least through working in chief executive and governance roles as well as high-level consultancy work. We are accustomed to working with governing
bodies, steering committees, task forces and other groupings to shape strategic direction and effect major organisational change as a result. Our biographical details demonstrate that we have developed, written and implemented many strategic plans,
including for the Higher Education Statistics Agency (HESA) and the Joint Information Systems Committee (Jisc), as well as contributing to strategy development for the Society of College, National and University Libraries (SCONUL) and Research
Libraries UK (RLUK).</div>
</div>
<div class="flex flex-col rounded-md bg-gray-200 p-8 items-center justify-center js-service-click">
<figure class="bg-blue-500 rounded-full flex items-center align-center justify-center w-32 h-32">
<img src="http://davidbakerconsulting.test/wp-content/uploads/2022/01/image-5.svg" class="attachment-full size-full" alt="" loading="lazy"> </figure>
<h2 class="text-lg font-bold mt-7">Consultancy</h2>
<div class="mb-2 text-primary overflow-hidden service-details">DBC delivers high-quality consultancy projects in higher education both nationally and internationally, with a long-standing track record, especially in strategy development. Associates have a broad and deep knowledge of the field.</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$('.services').on('click', '.js-service-click', function(e) {
$('.row-span-2').removeClass('row-span-2');
$(this).addClass('row-span-2');
$('.service-content-visible').removeClass('service-content-visible');
$(this).find('.service-details').toggleClass('service-content-visible');
});
</script>
https://stackoverflow.com/questions/70804213
复制相似问题