最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - How to auto-scroll images horizontally in responsive design - Stack Overflow

matteradmin4PV0评论

So i have this site: /. I have my portfolio images in a grid like formation using the <li> tag on the front page. I need them to align side by side and scroll horizontally automatically, maybe using javascript or jquery (no other libraries, please). It's fine if it has a scrollbar as well. I've tried something like this:

.portfolio li {
  width: 438px !important;
  display:inline !important;
}

and then

<ul id="thumbs" style="width:100%;list-style:none;display:block;white-space:nowrap;">
    <li class="portfolio" style="width: 438px; opacity: 1;display:inline;">
      <a href="BLAHBLAH" title="BLAHBLAH">
        <img src="BLAHBLAH" alt="" title="" >
      </a>
    </li>

that's basically just a stripped down version if you vist the page theres a lot more tags associated. but even this code alone (with all the tags closed obviously) didn't seem to work..

So i have this site: http://onthemouse./. I have my portfolio images in a grid like formation using the <li> tag on the front page. I need them to align side by side and scroll horizontally automatically, maybe using javascript or jquery (no other libraries, please). It's fine if it has a scrollbar as well. I've tried something like this:

.portfolio li {
  width: 438px !important;
  display:inline !important;
}

and then

<ul id="thumbs" style="width:100%;list-style:none;display:block;white-space:nowrap;">
    <li class="portfolio" style="width: 438px; opacity: 1;display:inline;">
      <a href="BLAHBLAH" title="BLAHBLAH">
        <img src="BLAHBLAH" alt="" title="" >
      </a>
    </li>

that's basically just a stripped down version if you vist the page theres a lot more tags associated. but even this code alone (with all the tags closed obviously) didn't seem to work..

Share Improve this question edited Jul 28, 2012 at 7:00 gherkins 15k7 gold badges46 silver badges74 bronze badges asked Jul 28, 2012 at 6:57 Atom VayalinkalAtom Vayalinkal 2,7028 gold badges30 silver badges37 bronze badges 3
  • What do you need? Your images already are placed side by side – d.k Commented Jul 28, 2012 at 7:21
  • i need them to scroll horizontally, without going on to the next line, so that i have a ton of space left on the bottom. – Atom Vayalinkal Commented Jul 28, 2012 at 7:25
  • Actually, what you want is not a responsive design – d.k Commented Jul 28, 2012 at 7:28
Add a ment  | 

2 Answers 2

Reset to default 1

You could consider using Flexislider for your problem here. It's a responsive slider.

http://www.woothemes./flexslider/

remove display:inline, width from style attr of your li

<ul id="thumbs" style="list-style:none;">
<li class="portfolio" style="opacity: 1;">
  <a href="BLAHBLAH" title="BLAHBLAH">
    <img src="BLAHBLAH" alt="" title="" >
  </a>
</li>



#works, #wrapper {
    overflow: visible;
}
body {
    overflow-x:auto;
}
#thumbs .portfolio {
    display:inline-block;
    width: 438px !important;
    float:none !important;
}
#thumbs {
    white-space:nowrap;
}
/* for ie 7*/
*:first-child+html #thumbs .thumb {
    display:inline;
    zoom:1;
}
/* for ie 6*/
*html #thumbs .thumb {
    display:inline;
    zoom:1;
}
Post a comment

comment list (0)

  1. No comments so far