From 3e033e897848e62fa5164519ebcb1cd93824e168 Mon Sep 17 00:00:00 2001 From: Steven Haskell Date: Tue, 23 Oct 2018 00:40:00 -0400 Subject: [PATCH] Wrote test Animation script Wrote a test animation script that should animate the plates on and off based off of the content. --- js/plateAnimation.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 js/plateAnimation.js diff --git a/js/plateAnimation.js b/js/plateAnimation.js new file mode 100644 index 0000000..332ff52 --- /dev/null +++ b/js/plateAnimation.js @@ -0,0 +1,37 @@ +function test () { + //checks if there are any plates showing + if (document.body.contains('.platevisual__plate')) { + //animates plates off + jQuery('.b-platevisual__plates--left').animate({ + opacity: 0, + left: "-=37%", + }, {duration: 500, queue: false }); + jQuery('.b-platevisual__plates--right').animate({ + opacity: 0, + left: "+=37%", + }, {duration: 500, queue: false }); + //updates plates + jQuery(".b-platevisual__plates").html(weighthtml); + //animates plates back on + jQuery('.b-platevisual__plates--left').animate({ + opacity: 1, + left: "+=37%", + }, {duration: 500, queue: false }); + jQuery('.b-platevisual__plates--right').animate({ + opacity: 1, + left: "-=37%", + }, {duration: 500, queue: false }); + } else { + //updates plates + jQuery(".b-platevisual__plates").html(weighthtml); + //animates plates back on + jQuery('.b-platevisual__plates--left').animate({ + opacity: 1, + left: "+=37%", + }, {duration: 500, queue: false }); + jQuery('.b-platevisual__plates--right').animate({ + opacity: 1, + left: "-=37%", + }, {duration: 500, queue: false }); + } + }