Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Uplift › SVG Icon Timing
New Landing › How can we help? › Themeforest Theme Support › Uplift › SVG Icon Timing
- This topic has 14 replies, 3 voices, and was last updated 7 years by Swift Ideas – Ed.
-
Posted in: Uplift
-
April 6, 2017 at 5:05 am #319863
Hi,
I was just wondering if there was a way to make the svg icons start animating on page load for the ones on our home page. Currently you have to scroll down before they start, so the design loses impact on load.
Thanks
April 8, 2017 at 4:57 pm #320163April 10, 2017 at 4:56 am #320241Thanks Ed, but is it not possible to have the icon animate as soon as the page loads? I love the animation, it’s why we chose the SVG icons.
April 10, 2017 at 10:38 pm #320447I just forward to Ed so he can reply.
-Rui
April 21, 2017 at 6:20 am #321810Hi, I was wondering if Ed was able to let me know of a possible solution to this?
April 21, 2017 at 11:55 am #321843I just forward it to Ed.
-Rui
April 22, 2017 at 4:28 pm #321976Hi @ronin,
Please can you try adding this to the Custom JS box:
jQuery(document).ready(function() { SPB.svgIconAnimate = { init: function () { jQuery('.sf-svg-icon-animate').each(function() { var thisSVG = jQuery(this), svg_id = thisSVG.attr('id'), file_url = thisSVG.data('svg-src'), anim_type = thisSVG.data('anim-type'); //path_timing = thisSVG.data('path-timing'), //anim_timing = thisSVG.data('anim-timing'); if ( thisSVG.hasClass('animation-disabled') ) { new Vivus(svg_id, { duration: 1, file: file_url, type: anim_type, start: autostart, selfDestroy: true, onReady: function(svg) { svg.finish(); } }); } else { new Vivus(svg_id, { duration: 200, file: file_url, type: anim_type, start: autostart, pathTimingFunction: Vivus.EASE_IN, animTimingFunction: Vivus.EASE_OUT, }); setTimeout(function() { thisSVG.css('opacity', 1); }, 50); } }); } }; });
– Ed
April 24, 2017 at 1:06 am #322012Thanks Ed, I tried that but it seems to have stopped our menu from working (the drop down doesn’t work). I’ve already got the custom js:
jQuery(document).ready(function() {
jQuery(document).on(‘click’, ‘.menu-div a’, function() {
jQuery(this).parents(‘.mega-sub-menu’).hide(400);
});
});Does your above code need to go inside there somehow?
April 25, 2017 at 2:44 am #322171Will do some testing on this and get back to you asap.
Thanks,
– Ed
April 26, 2017 at 12:14 am #322343Wonderful, thanks so much.
April 26, 2017 at 2:41 am #322346Please try this:
jQuery(document).ready(function() { SPB.svgIconAnimate = { init: function () { jQuery('.sf-svg-icon-animate').each(function() { var thisSVG = jQuery(this), svg_id = thisSVG.attr('id'), file_url = thisSVG.data('svg-src'), anim_type = thisSVG.data('anim-type'); //path_timing = thisSVG.data('path-timing'), //anim_timing = thisSVG.data('anim-timing'); if ( thisSVG.hasClass('animation-disabled') ) { new Vivus(svg_id, { duration: 1, file: file_url, type: anim_type, start: 'autostart', selfDestroy: true, onReady: function(svg) { svg.finish(); } }); } else { new Vivus(svg_id, { duration: 200, file: file_url, type: anim_type, start: 'autostart', pathTimingFunction: Vivus.EASE_IN, animTimingFunction: Vivus.EASE_OUT, }); setTimeout(function() { thisSVG.css('opacity', 1); }, 50); } }); } }; });
Tested that locally and it worked.
Thanks,
– Ed
April 26, 2017 at 3:18 am #322347Thanks Ed, appreciate it. I’m still getting the same error though (they don’t automatically animate and the menu stops working).
April 26, 2017 at 4:01 am #322348What error are you getting? As long as you add the code above independently from the other code (add a few lines between) should be no issue.
– Ed
April 28, 2017 at 7:23 am #322650Hi Ed,
I’m getting this error, don’t know if it’s related:
Uncaught ReferenceError: SPB is not defined
at HTMLDocument.<anonymous> ((index):1293)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at Function.ready (jquery.js?ver=1.12.4:2)
at HTMLDocument.K (jquery.js?ver=1.12.4:2)However the error I meant is just that the svg icons still don’t animate on load, and it stops the drop down menu from working. I have cleared the website’s cache as well as multiple browsers cache and it’s still looking the same.
April 28, 2017 at 12:25 pm #322690 -
Posted in: Uplift
You must be logged in to reply to this topic.