Solved

Javascript scrolling not working in Chrome

Posted on 2014-03-03
5
363 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
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.
This Micro Tutorial will demonstrate how marketers can use the Mobile Emulation Tool in Chrome Developer Tool. This will let you preview your site on any mobile device.

773 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