Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7078243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:31:21+00:00 2026-05-28T06:31:21+00:00

I would like to somehow paginate my scroll function so that I can choose

  • 0

I would like to somehow “paginate” my scroll function so that I can choose from a list of “tabs/buttons” and it will automatically scroll to that “div/tab”… Here is what I have, this is going through a while statement to generate songs in my database w/each “tab” being its own song…

///PHP///
$x=count($array);
$song .= '
<div class="tab">
   <div id="full">
    <div id="container" style="color:#00234A;"><h1>' . $title . '</h1></div>
    <hr style="margin-bottom:10px;" />
    <div class="transpose" style="background-color:#F3F3F3; border: 1px solid #D1D1D1; font-size:13px; padding:3px 10px; color:#225c7e; margin-bottom:10px;">
//////////HERE IS WHERE I WOULD LIKE THE BUTTONS//////////////////////
    transpose:&nbsp; 
      <a class="transposeUp" id="transposeUp'.$vID.'" title="transpose up" 
        onclick="return false" 
        onmousedown="transposeUp(\''.$vID.'\');">
      <span>&and;</span></a>&nbsp;
      <a class="transposeDown" id="transposeDown'.$vID.'" title="transpose down" 
        onclick="return false" 
        onmousedown="transposeDown(\''.$vID.'\');">
      <span>&or;</span></a>
    </div><br /><br />';
   </div>
</div>

Then my css…

.window{overflow:hidden; width:900px; font-size:14px;}
.space{width:<?php echo $i; ?>px; overflow:hidden;}
.tabs{float:left;}
.tab{float:left; width:900px; display:inline;}

My JS…

$('.scrollable a.left').click(function(e){
  var sz = $('.window');
  sz.animate({scrollLeft: "-=900"}, 300, 'linear');
}, function(e){
  $(sz).stop();
});

$('.scrollable a.right').click(function(e){
  var sz = $('.window'); 
  sz.animate({scrollLeft : "+=900"}, 300, 'linear');
}, function(e){
  $(sz).stop();
});

And HTML…

<div class="mainBodyTable">
    <div style="background-color:white; padding:10px 15px;">                    
        <div class="scrollable">
            <div class="window">
                <div class="space">
                    <div class="tabs">
                        <?php echo $song; ?>
                    </div>
                </div>
            </div>
            <a href="#" class="left">&larr;</a>
            <a href="#" class="right">&rarr;</a>
        </div>
    </div>
</div>

The idea is that there will be boxes as defined by $x and each box will have it’s respective number in it. When its clicked it will scroll to its respective div.
Can someone help at least with direction? Thanks in advance…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:31:22+00:00Added an answer on May 28, 2026 at 6:31 am

    To use this solution, you’ll need write your php such that your tabs have class attributes of yourClassSelector and incrementing id attributes that match their associated song.

    Something like:

    <?php 
        $i = 1;
        $count_of_tabs = // count() or my_sql_num_rows();
    
        while $i < $count_of_tabs:
           name_tab("your_tabs", $your_tab_array, $i);
           $i++;
        endwhile;
    
        function name_tab($tab_id_string, $tab_array, $b) {
           foreach($tab_array as $cur_tab) {
               $output = // insert html;
               $output .= $tab_id_string . $b;
               $output .= // insert more html;
               echo $output;
           }
        }
    ?>
    
    <script type="text/javascript">
    
    // I adapted this from another post on stackoverflow. I didn't write getOffset.
    
    function getOffset( el ) {
      var _x = 0;
      var _y = 0;
      while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
        _x += el.offsetLeft - el.scrollLeft;
        _y += el.offsetTop - el.scrollTop;
        el = el.offsetParent;
      }
      return { top: _y, left: _x };
    }
    
    jQuery('.yourClickSelector').click(function(e) {
      e.preventDefault(); 
    
      var tabId = jQuery(this).attr("id");
    
      var songId = jQuery(tabId + '-song');
    
      var x = getOffset( document.getElementById(songId) ).left;
      var y = getOffset( document.getElementById(songId) ).top;
      window.scrollTo(x,y)
    });
    
    </script>
    

    I did not proofread that after I wrote it, so don’t just copy and paste it and plug it in before reading it, please.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would like to make anapplication in Java that will not automatically parse parameters used
I have a static method in my code that I would like somehow to
I am running a mysql server. I would like to somehow make sure that
So basically I would like somehow that given an audio file as input (most
I would like to somehow send a file from my app on one android
I would like to somehow instrument a mako.lookup.TemplateLookup such that it applies certain preprocessors
I would like to somehow prevent certain assets from being included in the asset
I have some hidden inputs like this <input name=exam.normals[1].blahblah ..../> I would like somehow
In Javascript, I have a certain string, and I would like to somehow measure
Would like to get a list of advantages and disadvantages of using Stored Procedures.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.