0

What I'm trying to do is,

  • always stick class="new" div to the top of .inside div when you scroll down.
  • When you click on new div, create new row inside (at the top of table not at the bottom like now)

http://jsfiddle.net/tt13/5CxPr/13/

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
heron
  • 3,611
  • 25
  • 80
  • 148

3 Answers3

4

Here is a fiddle of what you want to achieve. Use prependTo instead of appendTo and use position:absolute;top:0; for keeping it on the top

Pranav 웃
  • 8,469
  • 6
  • 38
  • 48
  • thx for fast reply. One more thing, What I want to do is, to select mutiple rows by pressiong ctrl+left-click and one and only selection with only one - left click (I mean remove previous selected and select last clicked one; just like windows icon selection). How can I modify current code? – heron Feb 26 '12 at 08:50
  • 1
    @epic_syntax you sould post that as a different question then – Eduardo Feb 26 '12 at 10:39
  • @epic_syntax Do not post comments on all the answers and ask another question as a thread, post it as another question. Anyhow, look here http://stackoverflow.com/questions/2847135/check-ctrl-shift-alt-keys-on-click-event Also `live()` method is deprecated, use `on()` instead. http://api.jquery.com/live/ – Pranav 웃 Feb 26 '12 at 10:50
1

use prependTo() instead of appendTo() http://jsfiddle.net/uday99/5CxPr/20/

uday
  • 8,544
  • 4
  • 30
  • 54
  • thx for fast reply. One more thing, What I want to do is, to select mutiple rows by pressiong ctrl+left-click and one and only selection with only one - left click (I mean remove previous selected and select last clicked one; just like windows icon selection). How can I modify current code? – heron Feb 26 '12 at 08:51
1

try this one instead

the code is too long to put here but here are key notes:

  • to append to the top, use .prependTo()
  • separate the new button and create a scrollable div below it
Joseph
  • 117,725
  • 30
  • 181
  • 234
  • thx for fast reply. One more thing, What I want to do is, to select mutiple rows by pressiong ctrl+left-click and one and only selection with only one - left click (I mean remove previous selected and select last clicked one; just like windows icon selection). How can I modify current code? – heron Feb 26 '12 at 08:51