Forums

Give help. Get help.

  • odc
    # November 2, 2018 at 1:39 pm

    I want to write a function call that checks a variable and updates the DOM on my page by increasing this heart size.

    How do I increase this heart size with jquery?

    https://jsfiddle.net/5dn1L6s8/1/
    thanks

    # November 3, 2018 at 6:22 pm

    The animation will override the transform if it’s on the same element. You could target a parent element instead.

    codepen.io/anon/pen/KrKbvr

    odc
    # November 5, 2018 at 11:36 am

    thanks. could you help me with this problem ive been having as well. how do I make the gold heart move faster? with this if statement ive written preferably https://codepen.io/anon/pen/KrwaQq

    # November 5, 2018 at 5:54 pm

    I think something like this?

    function animateDiv(myclass) {
    
      var newq = makeNewPosition();
    
      if (myclass == '.heart.gold') {
        $(myclass).animate({ top: newq[0], left: newq[1] }, 1000, 'linear', function() {
          animateDiv(myclass);
        });
      }
      else {
        $(myclass).animate({ top: newq[0], left: newq[1] }, movingSpeed, 'linear', function() {
          animateDiv(myclass);
        });
      }
    }
    
    # November 5, 2018 at 7:49 pm

    I’ve optimised the script a bit:

    codepen.io/anon/pen/bQdoWm

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

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag