4

if you run below code snippet or [ js fiddle https://jsfiddle.net/3xdfwsk7/1/ ] , if we mouse-over on 2nd image, you can see apple1 to apple 12 values. but i want to display apple 1- apple 7 in one column and apple 8 to apple 12 in another column.

now :

enter image description here

what I need is :

enter image description here

#narrow-by-list { display :none;}
.choose1 
{ 
text-transform: capitalize; 
text-align: center;
font-weight:bold;
font-size:18px;
color: #000000;
}
.links1234 { color : #908983;}
.links1234:hover { color : #f85700;}


.grow {
  padding: 5px 5px 5px 5px;
  border-radius: 10px;
  width: 23%;
  margin: 5px 1% 5px 1%;
  float: left;
  position: relative;
  transition: height 0.5s;
  -webkit-transition: height 0.5s;
  text-align: center;
  background-color : #fff;
  
}
.grow:hover ul{
  display: block;
}

.grow ul {
  margin: 0;
  padding: 5px;
  list-style: none;
  display: none;
  position: absolute;
  z-index: 1;
  background: #fff;
  box-shadow: 0 0 5px 1px rgba(0,0,0,.25);
  left: 0;
  right: 0;
}

.grow img{
  width: 100%;
}

.expand 
{
 position:relative;
 right:8px;
 top:4px;
}
<div class="grow">
  <img class = "expand" src="http://sbdev2.kidsdial.com:81/media/cases/apple.png" onmouseover="this.src='http://sbdev2.kidsdial.com:81/media/cases/apple_active.png'"
onmouseout="this.src='http://sbdev2.kidsdial.com:81/media/cases/apple.png'"
border="0" alt=""/>
  <ul>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4.html">Apple Iphone 4</a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 4s </a>
    </li>
 <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4.html">Apple Iphone 4</a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 4s </a>
    </li>
  </ul>
</div>

<div class="grow">
  <img class = "expand" src="http://sbdev2.kidsdial.com:81/media/cases/apple.png" onmouseover="this.src='http://sbdev2.kidsdial.com:81/media/cases/apple_active.png'"
onmouseout="this.src='http://sbdev2.kidsdial.com:81/media/cases/apple.png'"
border="0" alt=""/>
  <ul>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4.html">Apple Iphone 1</a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 2 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 3 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 4 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 5 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 6 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 7 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 8 </a>
    </li>
 <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 9 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 10 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 11 </a>
    </li>
    <li>
      <a class="links1234" href = "http://sbdev2.kidsdial.com:81/cases-covers/art-graphics/iphone-4s.html">Apple Iphone 12 </a>
    </li>
  </ul>
</div>

Note : i need to display in 2 columns only if we have more than 7 values, if we hover on first image, than only 4 values are displaying, for that i don't want to display in 4 columns

This question is not duplicate as when i used other question's answer , it spoiled my column width....

  • Check this out http://stackoverflow.com/questions/2117320/set-maximum-displayed-rows-count-for-html-table – Luigi Cerone Sep 27 '16 at 12:32
  • Possible duplicate of [How to display list items as columns?](http://stackoverflow.com/questions/12332528/how-to-display-list-items-as-columns) – Lalji Tadhani Sep 27 '16 at 12:33
  • @LaljiTadhani when i used that link code, it displayed like this : http://prnt.sc/cmxq34 , means it displayed all menus in diferent columns , that fine, but along with that it should increase column width also, but thats not happening ..... –  Sep 27 '16 at 12:43
  • @LaljiTadhani please check this [link](http://sbdev2.kidsdial.com:81/cases-covers.html) and help me : now i want to increase column width –  Sep 27 '16 at 13:02
  • change column-count 3 of 2 – Lalji Tadhani Sep 27 '16 at 13:08
  • add ul width then increase column width – Lalji Tadhani Sep 27 '16 at 13:09
  • thanks a lot for support..... @LaljiTadhani –  Sep 27 '16 at 13:23

2 Answers2

3

Use below css

.grow:hover ul{
  display: block;
  column-count: 2;
}
.grow:hover ul li{
    display: inline-table;
    padding: 5px 12px;
}
  • now its displaying like this : http://prnt.sc/cmxu3j in this link [link](http://sbdev2.kidsdial.com:81/cases-covers.html) can you please help me to display as 2nd image in question..... –  Sep 27 '16 at 12:50
  • its applying for all images, means if you hover on any image , the values are displaying in 2 columns, but i dont want that, i wanted in 2 columns only if image have more values , please mouse-over on other images also in above link –  Sep 27 '16 at 13:00
  • after i used this code, now for 1st image also values are displaying in 2 columns : http://prnt.sc/cmxzbz –  Sep 27 '16 at 13:02
2

Use the column-count property from CSS3.

bjoster
  • 1,665
  • 1
  • 12
  • 17
  • please help me for [link](http://stackoverflow.com/questions/41561910/menu-dropdown-not-displaying-menu-items-in-internet-explorer/) –  Jan 10 '17 at 06:42
  • There are Plenty. Did you try an older release of [jQuery in noconflict](https://api.jquery.com/jquery.noconflict/) mode? – bjoster Jan 17 '17 at 14:37