The zebrafish has been widely used as a model organism in developmental biology and regeneration research. However, the first floxed allele of an endogenous zebrafish gene generated using transcription activator-like effector nuclease (TALEN)-mediated HR was only recently reported (Hoshijima et al., 2016). To expand the range of genetic tools that can facilitate cKO analysis in zebrafish, we explored an alternative approach using a Cre-dependent genetic switch referred to as FLEx (Schnütgen et al., 2003). FLEx is characterized by strategically arranged wild-type (WT) and mutant loxP sites that facilitate the induction of Cre-dependent stable inversion of a gene trap cassette (Schnütgen et al., 2003). Although similar approaches have been used for conditional gene trap mutagenesis in zebrafish (Clark et al., 2011; Ni et al., 2012; Jungke et al., 2016; Trinh et al., 2011), no reports have described the precise targeting of a FLEx cassette at defined loci. In the present report, we describe a streamlined method to generate a conditional allele using a FLEx-based genetic switch via in vivo HR. Using this approach, we successfully generated a targeted sonic hedgehog a (shha) cKO allele to analyze shha function during heart development and regeneration. Our findings demonstrate the utility of the FLEx-based method for cKO analysis of gene function in zebrafish.