Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8734515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:51:18+00:00 2026-06-13T09:51:18+00:00

I’m trying to create a fly to effet after clicking a button which is

  • 0

I’m trying to create a fly to effet after clicking a button which is working on the first click but if you click it again than the goto positions are somehow left: 15 and top 15 or left: 0, top: 0

I think that the problem is somewhere in the .clone() and .prependTo()
because the clone duplicates the id of the image but I couldn’t figure out how to remove the cloned image after the animation is finished.

So I need some help to make this work.

the html looks like this :

<div class="container">
 <div class="Pic" id="PiC_111"><a href="#"><img id="imG_111" src="img0.jpg"></a></div>
 <div class="Cont">
  <div class="desc"><!-- some text here --></div>
  <form method="POST" action="func.php">
    <!-- some form stuf -->
    <input type="submit" class="send" name="send" value="send" id="111" />
  </form>
 </div>
</div>
<div class="container">
 <div class="Pic" id="PiC_123"><a href="#"><img id="imG_123" src="img1.jpg"></a></div>
 <div class="Cont">
  <div class="desc"><!-- some text here --></div>
  <form method="POST" action="func.php">
    <!-- some form stuf -->
    <input type="submit" class="send" name="send" value="send" id="123" />
  </form>
 </div>
</div>
<!-- lot more of this -->

the JS looks like this

jQuery(document).ready(function($){
  $('input.send').click(function(){
    var imgID = (this.id);
    var posX = $('#imG_' + imgID).offset().left;
    var posY = $('#imG_' + imgID).offset().top;
    if($('#flytoID_' + imgID).length > 0) {
        var targetX = $('#flytoID_' + imgID).offset().left;
        var targetY = $('#flytoID_' + imgID).offset().top;
    } else {
        var targetX = $('#flytoTitleWrap').offset().left;
        var targetY = $('#flytoTitleWrap').offset().top;
    }
    var gotoX = targetX - posX + 20;
    var gotoY = targetY - posY + 20;
    var newImageWidth = $('#PiC_' + imgID).width() / 3;
    var newImageHeight = $('#PiC_' + imgID).height() / 3;

    $('#PiC_' + imgID + ' a img')
    .clone()
    .prependTo('#PiC_' + imgID +' a')
    .css({'position' : 'absolute', 'z-index' : '999999'})
    .animate({opacity: 0.4}, 100)
    .animate({opacity: 0.1, marginLeft: gotoX, marginTop: gotoY, width: newImageWidth, height: newImageHeight}, 1200, function(){
        $('#notificationsLoader').html('<img src=\"images/loader.gif\" />');
        $('#imglist').css({'background-position' : '-50px 0'}); 
    });
  });
});

Thanks in advance

I uploaded to jsfiddle: http://jsfiddle.net/Piszi/vD256/12/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:51:19+00:00Added an answer on June 13, 2026 at 9:51 am

    It really depends what exactly you wish to accomplish with this. In case you want to remove product image after it has been animated to basket you can replace part of your code with the following:

    var clone = $('#PiC_' + imgID + ' a img') //UPDATE
    .clone(true)
    .prependTo('#PiC_' + imgID +' a')
    .css({'position' : 'absolute', 'z-index' : '999999'})
    .animate({opacity: 0.4}, 100)
    .animate({opacity: 0.1, marginLeft: gotoX, marginTop: gotoY, width: newImageWidth, height: newImageHeight}, 1200, function(){
            $('#notificationsLoader').html('<img src=\"images/loader.gif\" />');
            $('#imglist').css({'background-position' : '-50px 0'}); 
            $(clone).remove(); //UPDATE new line
        });
    

    Please note that var clone keeps reference to the cloned object so you can do anything you want with it. Example you could change it’s id after animation has been complete with replacing $(clone).remove(); with clone.attr('id', 'myNewID'); etc…
    Update jsFiddle link: http://jsfiddle.net/salih0vicX/vD256/13/

    I’ve also noticed that some HTML elements are missing – example: jQuery is referencing to an element with id=”imglist”; there is no such element in provided HTML resulting with no loader.gif is being loaded; etc. Anyway, I hope this answered your question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to select an H1 element which is the second-child in its group
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.