0

I want to make an app looks like windows explorer. I was search what i need to build my app.

  1. dragable
  2. ajax for request
  3. etc.

for ajax i was found. and it work as well. but i have problem with jquery moveable div (I found it from csstrick) you can see what i was did from codepen with this link

my question is : how to create jquery movable but only header can move a whole div.? please dont suggest me to use jquery ui or jquery easy ui. i just want to build my app from 0, not using ready framework like ui/easyui. i dont know much about jquery/javascript. but with this app, i want to learn, that why i'm not using ui/easyui.

if you have link/google suggest keyword pleas tell me. sorry for my grammer or my language.

Thanks for adv.

EDIT 1:

let say for dummy code is like this.

<div class="move">
<div class="title">This is title</div>
<div class="content"></div>
</div>

if i use code from csstrick like what i was doing in example in codepen. i can move div in move area. but i want is i can move move div just from .title.

EDIT 2. This LINK is original csstrick script

EDIT 3.

I was found what i want.

Draggable div without jQuery UI

Community
  • 1
  • 1
3118731
  • 75
  • 1
  • 2
  • 10
  • If you don't want to use jQuery UI, at least study the source code for plugins you are interested in to understand how they work. – Joseph Gabriel Jan 16 '14 at 02:31
  • i was read carefuly code from csstrick, but i realy blank about jquery/javascript. so i need more example. – 3118731 Jan 16 '14 at 02:35

1 Answers1

0

Look closely on your code:

opt = $.extend({handle:"",}, opt);
    //if handle is empty drag by its container, else with the handle element
    if(opt.handle === "") {
        var $el = this;
    } else {
        var $el = this.find(opt.handle);
    }

As you can see you can specify a selector to handle the dragging, just need to pass your header selector.

$('.widget').drags({handle:".title"});

Updated your pen: codepen.io/anon/pen/sdBwo

Mark S
  • 3,789
  • 3
  • 19
  • 33
  • wow. thanks. i learning somethin' new here. thanks for your explain. for next time i'll read code more carefuly. – 3118731 Jan 18 '14 at 00:39