top of page
This website was created by Wix Fix

Hide Sections on Specific Dynamic Pages in Wix

  • Mar 23, 2022
  • 1 min read

Sometimes you want to showcase certain sections on specific dynamic pages and not others. Well in this lesson, you will learn how to show/hide sections on dynamic pages based on content in the database.


Hide Sections on Dynamic Pages in Wix

$w.onReady(function () { $w("#dynamicDataset").onReady(() => { let project = $w("#dynamicDataset").getCurrentItem(); if(project.one===true){ $w("#one").show(); $w("#one").expand(); } else { $w("#one").hide(); $w("#one").collapse(); } if(project.two===true){ $w("#two").show(); $w("#two").expand(); } else { $w("#two").hide(); $w("#two").collapse(); } if(project.three===true){ $w("#three").show(); $w("#three").expand(); } else { $w("#three").hide(); $w("#three").collapse(); } }); });

Just copy this code over and make sure the the name of the sections you want to hide match the name given in the editor. Also, make sure that you change ".one" to the field key from the database! Have fun!

Comments


bottom of page