Building on the Quick Start example, you can change the content of the card dynamically using the flipping event. In this case, we change the content based on the user's entry in an <input> element.
Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> require(["wijmo.wijflipcard"], function () { $(document).ready(function () { $("#playingflipcard").wijflipcard({ flipping: function (e, data) { if (document.querySelector("#num").value === "7") { data.backPanel.html('<img src="http://lorempixel.com/160/180/animals/7/SIGNS%20POINT%20TO%20YES/"/>'); } else if (document.querySelector("#num").value === "5") { data.backPanel.html('<img src="http://lorempixel.com/160/180/cats/1/Try%20again%20BRING%20TREATS/"/>'); } else { data.backPanel.html('<img src="http://lorempixel.com/160/180/animals/6/HECKS%20NO/"/>'); } } }); }); }); </script> |
Drop down and copy markup to paste inside the body tags
Markup |
Copy Code |
---|---|
<div id="playingflipcard"> <div style="text-align:center"> <img src="Images\wijmo.png" /> </div> <div style="text-align:center"> Back Panel </div> </div> <br/> <input id="num" type="text" size="2"></input> <p>With your yes or no question in <br/> mind, enter a number between one <br/> and ten, and then click the card <br/> to receive your reading. Click the<br/> card again to flip it back over.</p> |