Click here to Skip to main content
15,891,880 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,

I have a scrollTop() function in a jquery method that scrolls an element to the desired position based on the mouse movement.

This function always worked perfectly until I decided to remove the height of the element. By removing the height of the element, the element height is determined by the amount of tds (rows) in the element. Before the height was preset to 200px, now it works fine because some elements are 178px and others are 348px in height!

Why won't the scrolltop() function work now though? I am following the scrollTop line with breakpoints and the values are being computed perfectly but the element simply refuses to move down or up.

Thanks a lot,
Justin
Posted
Comments
Ali Reza Barkhordari 21-Apr-13 11:54am    
please attach some codes that tried with it / explain more with your codes
Jukatzu 21-Apr-13 11:57am    
Hi abforce,

info-col used to be the one commented, now its the one beneath it:

/*.info-col { float: left; width: 0px; height: 200px; padding: 0px 0 0 0; overflow:hidden;}*/
.info-col { float: left; width: 0px; padding: 0px 0 0 0; overflow:hidden;}


jquery scrolltop function:

$(".info-col").mousemove(function (mouse) {
$(".info-col").scrollTop((mouse.pageY - $(".info-col").offset().top) * .81);
})

Thanks a lot for your quick reply. If you need anything else please tell me.
Justin
Ali Reza Barkhordari 21-Apr-13 12:04pm    
sorry my friend , i cannot figure out the problem, are you want to create a scrollbar for your info-col ??
Jukatzu 21-Apr-13 12:06pm    
Yes, the scrolling occurs by getting the mouse Y position and scrolls the element relative to that. Now that used to work fine before I removed the height 200px as you see from above. What isn't it anymore?
Ali Reza Barkhordari 21-Apr-13 12:10pm    
if you just want to put a scrollbar to the info-col , you can set overflow:scrollbar in it's css

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900