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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:36:41+00:00 2026-06-04T04:36:41+00:00

I want to make something like navigation bar that can move whole element, without

  • 0

I want to make something like navigation bar that can move whole element, without allowing dragging anywhere on the parent entire element to control the dragging. For example:

<div class="undraggable">
    <div class="draggable"></div>
    content
</div>

Dragging on a title bar drags the whole window that it is contained within, but dragging elsewhere on the window container does not drag the window.

I tried to use dragresize but I can’t make only draggable (don’t want resizable) object with his code.

  • 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-04T04:36:41+00:00Added an answer on June 4, 2026 at 4:36 am
    1. Register your mousedown handler on the drag controller (e.g. the title bar of the window).
    2. When you are dragging, update the position of a different element (e.g. the window wrapper).

    I have an example of this here:
    http://phrogz.net/js/PhrogzWerkz/WerkWin.html

    If you need this to work with a specific library—like a jQuery UI library—then please edit your question to say say.

    Simpler Demo: http://jsfiddle.net/VCQuN/1/

    <div class="window">
      <div class="titlebar">Hello, World!</div>
      <div class="content">
        <p>Window <b>Content!</b></p>
      </div>
    </div>​
    
    // For each item with a `window` class…
    var windows = document.querySelectorAll('.window');
    [].forEach.call(windows,function(win){
    
      // …find the title bar inside it and do something onmousedown
      var title = win.querySelector('.titlebar');
      title.addEventListener('mousedown',function(evt){
    
        // Record where the window started
        var real = window.getComputedStyle(win),
            winX = parseFloat(real.left),
            winY = parseFloat(real.top);
    
        // Record where the mouse started
        var mX = evt.clientX,
            mY = evt.clientY;
    
        // When moving anywhere on the page, drag the window
        // …until the mouse button comes up
        document.body.addEventListener('mousemove',drag,false);
        document.body.addEventListener('mouseup',function(){
          document.body.removeEventListener('mousemove',drag,false);
        },false);
    
        // Every time the mouse moves, we do the following 
        function drag(evt){
          // Add difference between where the mouse is now
          // versus where it was last to the original positions
          win.style.left = winX + evt.clientX-mX + 'px';
          win.style.top  = winY + evt.clientY-mY + 'px';
        };
      },false);
    });
    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make something like that: @if ( some-statement ) { <div class=row-link>
I want to make something like this... :LoopBegin if ???? goto End some other
I have to make something like an accordion, but I want it to fade
say I want to make the first row of the excel ss something like
I want to make something that makes much sense, but I think its not
I'm new to web design. I want to make my page look something like
I want to make something like this: <Controls:TreeView> <Controls:TreeViewItem Header=Persons Visibility={Binding Items[Persons], Path=IsVisible, Converter={StaticResource
I have problem with php's preg_match.I want to make something like this : When
I want to make something like this: http://www.birdtheme.org/useful/googletool.html But I want to change the
I want to make something like this drag bookmarket to your browser in order

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.