4

I am trying to implement a drop up menu. As a starting point I am using an existing drop down menu built using HTML/CSS/jQuery based on CSS trick's Simple jQuery Dropdowns. (As I couldn't get a pure css one to work on touch devices as they relied on hover states.)

I have made a little bit of progress fiddling with ul.dropdown ul {top: -100%; } but this only moves the dropdown up one 'row', I am not convinced that's semantic css.

Any ideas how I could achieve this ?

I have made a jsfiddle of the problem here - http://jsfiddle.net/TTTb6/

adrien54
  • 1,620
  • 1
  • 26
  • 31
sam
  • 9,486
  • 36
  • 109
  • 160

3 Answers3

4

Try changing this:

ul.dropdown ul {
    bottom: 100%;
}

Updted jsfiddle

DarkAjax
  • 15,955
  • 11
  • 53
  • 65
  • NP, it's a long code, things like that are easy to overlook :) – DarkAjax Apr 26 '13 at 16:23
  • The only quirk ive noticed is that the menu is now back to front - ie. first item in the css is now last, but its not a particular problem as you can just write the list backwards – sam Apr 26 '13 at 16:33
2

Instead of top, use bottom: 100%;:

ul.dropdown ul {
    position: absolute;
    bottom: 100%;
}
Derek Henderson
  • 9,388
  • 4
  • 42
  • 71
-2

For touch devices you need to write code in click event. please check this one here you will get your answer...

Click to close jQuery dropdown menu on mobile devices while retaining other behavior

Community
  • 1
  • 1
Jilani J
  • 49
  • 5
  • Of course one has to trigger the event. The OP knows that. The OP is asking about styling (positioning) of an element, not how to trigger events. – Derek Henderson Apr 26 '13 at 16:31