Jump to content

[SOLVED] Scrolling won't function properly


Recommended Posts

Hey guys.

 

to clear things up,

 

this is in php but its mostly html and the error I am having is the html functioning so I figured it was fit for the html section. If I was wrong in putting it in this board then by all means move it to the correct section and I am gratefully sorry.

 

Okay now that thats cleared up, here's whats going on:

 

I have a page and I would like it to start scrolling one it goes beyond a height of 204.

 

here's the script:

 

<table background=\"images/items.png\" width=177 height=289 style=\" padding-top: 22px; background-repeat: no-repeat;\">
       <tr>
    <td style=\"padding-top: 2px; padding-left: 4px; \" valign=\"top\">";
$queryz = mysql_query("SELECT * FROM inventoryitems WHERE characterid = '$id' AND inventorytype = 1 AND quantity != 0");// Account section

echo "   
                <DIV id=\"tabcontent1\" style=\"MARGIN-LEFT: 0px; MARGIN-RIGHT:0px; OVERFLOW-X: hidden; OVERFLOW: auto; HEIGHT: 204;\">
              <table cellspacing=0 cellpadding=0 border=0>
	           <tr>";
while($row = mysql_fetch_array($queryz)){
$item = $row[itemid];
if ($p%4==0 AND $p>=3) { 

                                      echo "
	           </tr>
	           <tr>"; 
} else { }
echo "
		        <td background=\"images/bgitem.jpg\" width=36 height=34 align=\"center\">
                                        <img src=\"http://www.mapletip.com/images/maplestory-monsters/0$item.png\" style=\"max-width:36px; max-height:34px;\" alt=\" \">
                                </td>";
$p++;
}
echo " 
		   </tr>
		</table>
	</div>";

 

 

As you can see, I am trying to get the content located in the <div> tags to scroll . it doesn't necessarily have to be div tags or anything as long as the scroll works and the content lays inside still :)

 

anyone have any ideas? 

Link to comment
https://forums.phpfreaks.com/topic/178129-solved-scrolling-wont-function-properly/
Share on other sites

Not quite sure what you mean by the page scroll after a height of 204?

 

Or do you mean content of the div after its 204?

 

You can do this with content overflow in css.

 

div#tabcontent1 {
height:204px;
overflow: scroll
}

 

Try it out!  ;)

What exactly is going in the tabcontent1 div?

 

I have stripped back all your php stuff to leave just the html code so i can see whats going on.

There was a error with the html, but that didnt stop the overflow working.

 

Just so we can establish that you are seeing what i am seeing, try this plain html code:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="test.css" />
</head>

<body>
<td background="images/items.png" width=177 height=289 style=" padding-top: 22px; background-repeat: no-repeat">
       <tr>
       <td style="padding-top: 2px; padding-left: 4px;" valign="top">
  
                <div id="tabcontent1">
                 <table cellspacing=0 cellpadding=0 border=0>
                 <tr>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
			 <p>some text</p>
                 <td background="images/bgitem.jpg" width=36 height=34 align="center">
                                        <img src="http://www.mapletip.com/images/maplestory-monsters/0$item.png" style="max-width:36px; max-height:34px;" alt=" ">
                                </td>
            </tr>
         </table>
      </div>
</body>
</html>

 

Then in a seperate style sheet named "test.css"

div#tabcontent1 {
height:204px;
overflow: scroll
}

 

I know its going back to basics, but sometimes its the best way to find a problem.

That code should scroll anything within the div "tabcontent1"

 

hey i figured out the problem. its actualy simply the overflow-x:hidden; part that wasnt allowing the rest of it to flow. i moved the div styles to the stylesheet anyway to clear things up a bit.

 

I dont realy need the overflow-x:hidden; tag because if u use overflow:auto; then it works just as well.

 

thanks problem solved

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.