Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design Jquery + CSS HELP

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #278409
    odc
    Participant

    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

    #278450
    Shikkediel
    Participant

    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

    #278482
    odc
    Participant

    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

    #278483
    Shikkediel
    Participant

    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);
        });
      }
    }
    
    #278487
    Shikkediel
    Participant

    I’ve optimised the script a bit:

    codepen.io/anon/pen/bQdoWm

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design’ is closed to new topics and replies.