Solved

Javascript scrolling not working in Chrome

Posted on 2014-03-03
5
362 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
ID: 39900760
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
ID: 39901036
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
ID: 39901055
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

895 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

14 Experts available now in Live!

Get 1:1 Help Now