www.webdeveloper.com
Results 1 to 2 of 2

Thread: Changing four <li> - entries each row to two or three

  1. #1
    Join Date
    Dec 2012
    Posts
    2

    Changing four <li> - entries each row to two or three

    I am going to list the code first and explanation later.

    I have this HTML-Code

    HTML Code:
        <div class="develop-bl">   <i></i>          
          <ul>						                      
            <li>                     
            <a href="#">entry</a>                     
            </li>						                      
            <li>                     
            <a href="#">entry</a>                     
            </li>						                      
            <li>                     
            <a href="#">entry</a>                     
            </li>						                      
            <li>                     
            <a href="#">entry</a>                     
            </li>						                      
            <li>                     
            <a href="#">entry</a>                     
            </li>						                      
            <li>                     
            <a href="#">entry</a>                     
            </li>						                      
            <li>                     
            <a href="#">entry</a>                     
            </li>						                      
            <li>                     
            <a href="#">entry</a>                     
            </li>	     
          </ul>	     
        </div>
    and this Javascript-Code

    Code:
        var y = $ ('.develop-bl').find('li').length;
        	if(y%4>=0) {
        		$('.develop-bl li:nth-child(4n+4)').css('margin-right','0px');}
        	if(y%4==0) {
        		$('.develop-bl li').slice(-4).css('border-bottom','none');}
        	else {
        		var y = $('.develop-bl').find('li').length;
        		var b = y/4;
        		var values = b.toString().split('.');
        		var v2 = parseFloat(values[1]);
        			if(values[1]==5) {
        				$('.develop-bl li').slice(-2).css('border-bottom','none');}
        			else{
        			var i = values[1]*0.04;
        				$('.develop-bl li').slice(-i).css('border-bottom','none');}						
        	};
    The goal is to have 4 li-entries each row, which this code accomplishes. What needs to be changed to have 3 or 2 entries each row?

  2. #2
    Join Date
    Dec 2012
    Posts
    2
    Push

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles