Solved

Javascript scrolling not working in Chrome

Posted on 2014-03-03
5
359 Views
Last Modified: 2014-06-01
Hi Experts,

i use the following Javascript function to scroll content in i div container, and it works in Ie, Firefox and Safari + iPad Safari, but NOT in Chrome.

Anyone knows why? heres the code:

<script type="text/javascript">
function toLeft(id){
document.getElementById(id).scrollLeft=0
}

defaultStep=1
step=defaultStep
function scrollDivLeft(id){
document.getElementById(id).scrollLeft+=step
timerLeft=setTimeout("scrollDivLeft('"+id+"')",5)
}
</script>
------------------
<style type="text/css">
.div4 {
  position: relative;
  text-align: center;
  font-family:Verdana, Geneva, sans-serif;
  font-size:12px;
  color:#FFFFFF;
  width: 500px;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: hidden;
  z-index:3;
}
</style>
--------------------------------------
Container:

        <div id="thumbs" class="div4">
        <table>
            <%
            for each img in imgs
            nr = nr+1
                  title = replace(img.Name, ".jpg", "")
                  reptitle = Right(title, Len(title) - 3)
            %>
        <td height="60px">
        <img class="thumbn" src="Abergphotos/<%=img.Name%>" height="50px" id="img<%=nr%>" onmouseover="this.style.cursor='pointer'" onclick="chgimg('<%=nr%>', this.id, this.src, '<%=reptitle%>');" />
        </td>
        <%next%>
        </tr>
        </table>
        </div>

<input type="button" value="left"  onmousedown="scrollDivLeft('thumbs');">

Best regards
MortenWB
0
Comment
Question by:MortenWB
  • 2
5 Comments
 
LVL 16

Expert Comment

by:SriVaddadi
Comment Utility
Looks like you are missing <tr>. You have </tr> but i don't see <tr> any where.

Can't really say looking at the above snippet.  

Launch development tools in chrome and look at the console for any errors.
0
 

Author Comment

by:MortenWB
Comment Utility
Hi SriVaddadi,

thanks for commenting. And oh, the <tr> is in some of the code I left out in order to make it faster to read in this post - its in a table wrapped around the code.
I'll try to check the development console.
0
 

Accepted Solution

by:
MortenWB earned 0 total points
Comment Utility
Well - it may be a chrome version problem - had to download Chrome to the Mac i'm currently working on, and the code works perfectly there - the problem were on another Mac-Chrome... thought that Chrome updated automatically...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
This Micro Tutorial will demonstrate MozBar viewing metadata, such as description, page title, markup.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now