• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

how to apply jquery scrollbar to my XF code

TBDragon

Active member
#1
hi

i write an addon so its display for me all resources of cerstion category on a sidebar depend on which resource i browse
so its take the resource id and get the category id then retrieve the other resource from that category

so this is the display code

PHP:
//HTML taggs
$befor = '<dl>
            <dt>
                                <a href="resources/';
$cont_tags1 = '">';
$after= '               </a>              
                        </dt>
               
                </dl>
        ';                            
foreach ($AllRresource as $resource ) {
       
        $id = $resource['resource_id'];
        $title       = $resource['title'] ;
       // echo '<a href="resources/'.$resource['resource_id'].'">'.$resource['title'].'</a>';
       if ($id == $resource_id ){
                echo'<h3> انت تتابع حاليا</h3>'.$befor.$id.$cont_tags1.$title.$after;
       }else
        echo $befor.$id.$cont_tags1.$title.$after;
}
and its work fine
but with large number of resources in some categories its really bad look

see for example

upload_2014-3-16_13-36-21.png

its really long list =(

so i search for a scrollbar to use but i didnt know how to implement it as i dont know that much about jquery or js =(

also the second issue that is u see in the code above

PHP:
if ($id == $resource_id ){
                echo'<h3> انت تتابع حاليا</h3>'.$befor.$id.$cont_tags1.$title.$after;
       }
its should print some words like u r watching ( the resource name )
so i need to the scorllbar to move to that postion of the resource i browse now << hope u got what i mean

i read some scorllbar js/jquery addons they have some methods called position
i even contact with the author of that addons but no response !!
so i hope i can get some help here
 

Attachments

Chris D

XenForo developer
Staff member
#2
I'm only going to comment on the correct way to do a scrollbar: don't use jQuery. It can be achieved very easily by setting your block to have a max-height and setting overflow-y: auto;
 

TBDragon

Active member
#3
I'm only going to comment on the correct way to do a scrollbar: don't use jQuery. It can be achieved very easily by setting your block to have a max-height and setting overflow-y: auto;
first thanks for the advice
its work perfect with
max-height : 250px
overflow-y: overlay

and the scrollbar issue done

but what about the next thing =( scrolling to the ( resource i watch ) position ?!
is that possible to implement ?!

and thanks

u r the saver here <3<3
 

EQnoble

Well-known member
#4
When you say scrolling to position, are you looking to add buttons to scroll or do you mean like an auto scrolling thing...something like this?

(this is done with jQuery)

 

TBDragon

Active member
#5
When you say scrolling to position, are you looking to add buttons to scroll or do you mean like an auto scrolling thing...something like this?

(this is done with jQuery)

yes auto scrolling

like
iam watching resource id ( 10 )

and i have list of resources from id (1 :: 50 )
normal displaying will display as normal start of 1
but i want it to start of id(10)
and the user can scroll up or down for the rest

hope u got what i mean

thanks