Solved

Javascript scrolling not working in Chrome

Posted on 2014-03-03
5
368 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The purpose of this video series is to go through the basics of Google Analytics. This is the first video in the three part series. This tutorial goes through the setup as well as the Overview tab with in the application. Make sure that your Google …
This Micro Tutorial will demonstrate using MozBar to view an article that was deleted from the Search Engine Watch site after being debunked by Google.

734 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