javascript - Bootstrap modal like behavior in React -
i'm handling image click on object display pop-up box. code.
<a href="#" onclick={this.handleclick} data-id={image.id}>
this handleclick method.
handleclick(event) { event.preventdefault(); let mediaid = event.currenttarget.attributes['data-id'].value; this.setstate({overlay: <overlay mediaid={mediaid}/>}); }
this relevant css
.overlay { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); height: 300px; width: 500px; background-image: linear-gradient(to top right, #7282fb, #755bf9, #7934f7); box-shadow: 10px 10px 20px gray; }
i want pop-up slide page top, bootstrap modal.
also want overlay go, if click anywhere outside box.
how can achieve this. thanks.
looks need use library archive desired behavior. there react, can found "modal", "overlay" keywords. lot of alternatives exist. take @ https://github.com/fckt/react-layer-stack (check alternatives https://github.com/fckt/react-layer-stack#alternatives). solves case perfectly. demo , examples - https://fckt.github.io/react-layer-stack/
Comments
Post a Comment