Viewing 15 posts - 1 through 15 (of 15 total)
  • Posted in: Uplift
  • #319863
    ronin
    Member
    Post count: 282

    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

    #320163
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hi @ronin

    In the icon box options, there is the “Animate SVG Icon” option – turn that off?

    – Ed

    #320241
    ronin
    Member
    Post count: 282

    Thanks 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.

    #320447
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    I just forward to Ed so he can reply.

    -Rui

    #321810
    ronin
    Member
    Post count: 282

    Hi, I was wondering if Ed was able to let me know of a possible solution to this?

    #321843
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    I just forward it to Ed.

    -Rui

    #321976
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hi @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

    #322012
    ronin
    Member
    Post count: 282

    Thanks 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?

    #322171
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Will do some testing on this and get back to you asap.

    Thanks,

    – Ed

    #322343
    ronin
    Member
    Post count: 282

    Wonderful, thanks so much.

    #322346
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Please 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

    #322347
    ronin
    Member
    Post count: 282

    Thanks Ed, appreciate it. I’m still getting the same error though (they don’t automatically animate and the menu stops working).

    #322348
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    What 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

    #322650
    ronin
    Member
    Post count: 282

    Hi 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.

    #322690
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hi @ronin

    Looks like your SF plugin version is behind – can you check that?

    – Ed

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.