Перейти к публикации
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Чередование фона

Опубликовано:

Каким образом реализовать чередование фона ответов в теме?

 

Добавление скрипта в topicViewTemplate, не помогает...

 

       <script src="/jquery.js"></script>
<script type="text/javascript">
$(function(){
 $('.bg-post:odd').addClass('bg-change');
})
</script>
		<foreach loop="post_data:$post_data as $post">

<div class='bg-post'>       

			{parse template="post" group="topic" params="$post, $displayData, $topic, $forum"}
       </div>       
		</foreach>

Рекомендованные сообщения

Опубликовано:
  • Автор

Помогла такая конструкция

 

<if test="hasPosts:|:is_array( $post_data ) AND count( $post_data )">
	<div id='ips_Posts'>
 <style>
  .bg-post:nth-child(2n) {
   background: #fafafa !important; /* Цвет фона */
  }    
 </style>
 			<foreach loop="post_data:$post_data as $post">

<div <if test="$post['post']['post_count']==1"> class='bg-change' <else />class='bg-post'</if> >       

			{parse template="post" group="topic" params="$post, $displayData, $topic, $forum"}
</div>       
		</foreach>
</div>
   </if> 

 

может кому-нибудь пригодиться...

Опубликовано:
  • Автор

topicViewTemplate

Корректировка. У меня небольшой перекос в шаблоне post по дивам, из-за чего первый и второй пост шли с одним цветом фона. В нормальном режиме условие if по первому посту не требуется.

 


<if test="hasPosts:|:is_array( $post_data ) AND count( $post_data )">
       <div id='ips_Posts'>
 <style>
  .bg-post:nth-child(2n+1) {
   background: #fafafa !important; /* Цвет фона */
  }    
 </style>
           <foreach loop="post_data:$post_data as $post">

<div class='bg-post'>       

               {parse template="post" group="topic" params="$post, $displayData, $topic, $forum"}
</div>       
           </foreach>
   </div>
   </if> 

Создайте аккаунт или войдите в него для комментирования

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.