mohmal
mohmal

Reputation: 35

How to hide a Blogger section if its widget invisible

ok see this code

<b:section id='page-list'>
  <b:widget id='PageList1' locked='false' type='PageList' version='2' visible='true'>
  </b:widget>
</b:section>

I wanna Hide all section if widget invisible I use this code

cond='data:widgets.PageList.notEmpty'

like this

<b:section cond='data:widgets.PageList.notEmpty' id='page-list'>
  <b:widget id='PageList1' locked='false' type='PageList' version='2' visible='true'>
  </b:widget>
</b:section>

it's work but whene I add another widget "PageList" than appears again .. If it can be solved without jq & java ... just use conditionnelles tag for blogger ...

Upvotes: 0

Views: 1542

Answers (2)

user6144987
user6144987

Reputation:

data:widgets.PageList.notEmpty tests every widget of pageList type in the template. To apply the condition on a specific widget, use the widget id PageList1 instead of the type.

As the widget id doesn't exist in data:widgets, you can do that using a lambada expression

cond='(data:widgets.PageList filter (w => w.id == "PageList1")).notEmpty'

Upvotes: 3

Jacob
Jacob

Reputation: 48

Try the css property visibility: hidden;

.hidden {
  visibility: hidden;
}
<b:section class="hidden" id='page-list'>
  <b:widget id='PageList1' locked='false' type='PageList' version='2'>
  </b:widget>
</b:section>

Upvotes: 1

Related Questions