Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="accordeon">
	<ul class="accordeon__list">
<!-- 	first Item -->
    <li class="accordeon__item">
      <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero maxime error  quidem officiis porro eligendi iste dolores dolor magni, repellendus molestias totam, aliquid quasi molestiae soluta esse dignissimos corporis iure.</p>
      <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero maxime error  quidem officiis porro eligendi iste dolores dolor magni, repellendus molestias totam, aliquid quasi molestiae soluta esse dignissimos corporis iure.</p>
   <!--    Все что в этой обертке будет скрыватся
      	<div class="accordeon__inner"> </div> -->
				  
			<p >Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero maxime error  quidem officiis porro eligendi iste dolores dolor magni, repellendus molestias totam, aliquid quasi molestiae soluta esse dignissimos corporis iure.</p>
      <p >Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero maxime error  quidem officiis porro eligendi iste dolores dolor magni, repellendus molestias totam, aliquid quasi molestiae soluta esse dignissimos corporis iure.</p>
			 
			
			<a href="#" class="accordeon__trigger js-accordeon__trigger"></a>
		</li>
<!-- 	first Item end -->	
<!-- 	second Item -->
    <li class="accordeon__item">
      <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero maxime error  quidem officiis porro eligendi iste dolores dolor magni, repellendus molestias totam, aliquid quasi molestiae soluta esse dignissimos corporis iure.</p>
      <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero maxime error  quidem officiis porro eligendi iste dolores dolor magni, repellendus molestias totam, aliquid quasi molestiae soluta esse dignissimos corporis iure.</p>  
			<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero maxime error  quidem officiis porro eligendi iste dolores dolor magni, repellendus molestias totam, aliquid quasi molestiae soluta esse dignissimos corporis iure.</p>
				  
			<a href="#" class="accordeon__trigger js-accordeon__trigger"></a>
		</li>
<!-- 	second Item end -->
	</ul>
</div>
              
            
!

CSS

              
                /*--------------------Accordeon----------------*/
.accordeon {
	padding: 50px;
}

.accordeon__trigger {
	color: #333;
	display: block;
	padding: 6px;
	text-decoration: underline;
  cursor: pointer;
}

.accordeon__inner {
   padding: 0px;
}

.accordeon__item {
	list-style: none;
}
.accordeon__inner p {
  margin-top: 0px;
}

.accordeon__inner-item {
	list-style: none;
	margin-bottom: 2px;
}

.accordion__inner-link {
	text-decoration: none;
	color: #34495e;
	border-bottom: 1px dotted #34495e;
}

.accordeon__inner {
	display: none;
} 
	
.accordeon__trigger:before{
  content: "read more";
  display: block;
  font-size: 17px;
}
.active .accordeon__trigger:before{
  content: "less";
}
              
            
!

JS

              
                $(document).ready(function() {
  function pasteAccordeon() {
    var allLi = $('.accordeon__list').find('.accordeon__item'),
        allLiLength = allLi.length, //мы незнаем сколько будет ли, узнаем...
        i = 0;
    Array.from(document.querySelectorAll('.accordeon__item > p:nth-child(n + 3)')).forEach(e => e.classList.add('accordeon__inner'));

    // for (i = 0; i < allLiLength; i++) {
    //   var curLi = allLi[i];
      //$('.accordeon__item p:gt(1)').addClass('accordeon__inner');
      
    }
  pasteAccordeon();
  
  
	$('.js-accordeon__trigger').on('click', function(event) {
		event.preventDefault();
		
		var $this = $(this), //сохраняем в переменные все с чем будем работать
		    item = $this.closest('.accordeon__item'),
		    list = $this.closest('.accordeon__list'), //весь наш список
		    items = list.find('.accordeon__item'), // все ли вехнего уровня
        
			content = item.find('.accordeon__inner'),// весь внутренний список который будет открыватся
			otherContent = list.find('.accordeon__inner'), // все ли с контентом
			duration = 300; // время за которое пройдет анимация
		
		if (!item.hasClass('active')){   //если у конкретного ли нет активного класса
			items.removeClass('active'); //удалить активные классы у других ли
			item.addClass('active');     //и присвоить актив этому конкретному ли
			otherContent.stop(true, true).slideUp(duration); //свернуть все ли с контентом
			content.stop(true, true).slideDown(duration); //развернуть тот у кого активный класс
		} else {
			content.stop(true, true).slideUp(duration); 
			items.removeClass('active');                
		}                                               
	
	});	
 
});
              
            
!
999px

Console