1234567891011121314151617181920212223242526 |
- //本插件由www.swiper.com.cn提供
- function swiperAnimateCache() {
- for (var allBoxes = window.document.documentElement.querySelectorAll(".ani"), i = 0; i < allBoxes.length; i++) allBoxes[i].attributes["style"] ? allBoxes[i].setAttribute("swiper-animate-style-cache", allBoxes[i].attributes["style"].value) : allBoxes[i].setAttribute("swiper-animate-style-cache", " "),
- allBoxes[i].style.visibility = "hidden"
- }
- function swiperAnimate(a) {
- var effect,style,duration,delay;
- clearSwiperAnimate();
- var b = a.slides[a.activeIndex].querySelectorAll(".ani");
- for (var i = 0; i < b.length; i++) b[i].style.visibility = "visible",
- effect = b[i].attributes["swiper-animate-effect"] ? b[i].attributes["swiper-animate-effect"].value: "",
- b[i].className = b[i].className + " " + effect + " " + "animated",
- style = b[i].attributes["style"].value,
- duration = b[i].attributes["swiper-animate-duration"] ? b[i].attributes["swiper-animate-duration"].value: "",
- duration && (style = style + "animation-duration:" + duration + ";-webkit-animation-duration:" + duration + ";"),
- delay = b[i].attributes["swiper-animate-delay"] ? b[i].attributes["swiper-animate-delay"].value: "",
- delay && (style = style + "animation-delay:" + delay + ";-webkit-animation-delay:" + delay + ";"),
- b[i].setAttribute("style", style)
- }
- function clearSwiperAnimate() {
- var effect;
- for (var allBoxes = window.document.documentElement.querySelectorAll(".ani"), i = 0; i < allBoxes.length; i++) allBoxes[i].attributes["swiper-animate-style-cache"] && allBoxes[i].setAttribute("style", allBoxes[i].attributes["swiper-animate-style-cache"].value),
- allBoxes[i].style.visibility = "hidden",
- allBoxes[i].className = allBoxes[i].className.replace("animated", " "),
- allBoxes[i].attributes["swiper-animate-effect"] && (effect = allBoxes[i].attributes["swiper-animate-effect"].value, allBoxes[i].className = allBoxes[i].className.replace(effect, " "))
- }
|