1. 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

Discussion in 'General PHP and MySQL Discussions' started by TBDragon, Mar 16, 2014.

  1. TBDragon

    TBDragon Active Member


    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


    //HTML taggs
    $befor '<dl>
                                    <a href="resources/'
    $cont_tags1 '">';
    $after'               </a>              
    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 ){
    '<h3> انت تتابع حاليا</h3>'.$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


    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

    if ($id == $resource_id ){
    '<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

    Attached Files:

  2. Chris D

    Chris D XenForo Developer Staff Member

    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;
  3. TBDragon

    TBDragon Active Member

    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
  4. EQnoble

    EQnoble Well-Known Member

    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 likes this.
  5. TBDragon

    TBDragon Active Member

    yes auto scrolling

    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


Share This Page