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 7789113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:11:58+00:00 2026-06-01T21:11:58+00:00

I have draggable DIV’s. An image is appended in these DIV’s. When mouse is

  • 0

I have draggable DIV’s. An image is appended in these DIV’s. When mouse is over DIV’ s, the opacity of the image is changed to 1. When mouse is out, image gets opacity 0.

  1. On Click I want to change image from close_1.jpg to image close_2.jpg – and stop dragging that DIV.

  2. I want to change position of the image to the left + top side. 5px upper DIV.

Example

CSS

div {
      width:200px;
      padding:10px;
      border: 2px solid #fff;
      cursor: pointer;
      background: #ccc;
}

HTML

<img class="close" src="http://ynternet.sk/test2/close_1.jpg" />
   <div>Demo 1 Div </div>
   <div>Demo 2 Div </div>
   <div>Demo 3 Div </div>

JavaScript

$(document).ready(function() {
  $('div').append( $("img.close").css("opacity", "0" ));
  $('div').find('img.close').css("paddingLeft", "20px");
  $('div').mouseover(function() {
      $(this).stop().animate({borderColor: "#aaa" }, "slow");
      $(this).find('img.close').css("opacity", "1");
  }).mouseout(function() {
      $(this).stop().animate({borderColor: "#fff" }, "slow");
      $(this).find('img.close').css("opacity", "0");
  })
  $('div').draggable({ grid: [ 10,10 ] });
});
  • 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-01T21:12:00+00:00Added an answer on June 1, 2026 at 9:12 pm

    Adding this will stop the drag and change the image:

    $('div img').click(function() {
        $(this).attr('src', 'http://ynternet.sk/test2/close_2.jpg').parent().draggable("destroy");
    });​
    

    jsFiddle example.

    I’m just not clear on what you meant in #2 by “5px upper DIV”.

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

Sidebar

Related Questions

I have a draggable image within a div. I can click on the image
I have a draggable object (div), and some droppable ones (table TD's). I want
I have a jquery draggable div and i want the position to be saved
I try I have these: <div> <div class=faviconDiv> <a class=linkBig link draggableTitle ui-draggable href=http://www.youtube.com/watch?v=W3mP34Uznyk>EREN
I have multiple JavaScript draggable DIV windows. When clicking a DIV, I want the
I have a draggable table which all working fine, though I want to be
I have some particular need to clone an element (image) and be draggable inside
I have a form created in Windows Forms which is draggable wherever I click.
I have a jquery ui draggable div, and the HTML contents do not behave
I have a jQuery draggable container div with a side scroll bar that should

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.