Issue with div scroll left and right javascript

I tried everything but with no luck. I dont know what i did wrong. Please help me! All I wanted to do is to create a button that can scroll right and left of the schedule-background-container. Thank you in advance for any help html

July 23

July 24

CSS #schedule-button-right { background-color: grey; position: absolute; width: 9px; height: 8px; margin-top: 10px; margin-left: 145px; cursor: pointer; z-index: 2; } #schedule-button-left { background-color: grey; position: absolute; width: 9px; height: 8px; margin-top: 10px; margin-left: 5px; cursor: pointer; z-index: 2; } #schedule-background { background-color: white; position: absolute; margin-top: 120px; margin-left: 10px; -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); width:160px; height: 600px; float: left; overflow: hidden; } #schedule-heading-container { background: #088a26; width: 160px; height: 25px; } #schedule-background-overall { min-width: 320px; float: left; position:relative; } .schedule-background-container { width:160px; height:600px; float: left; position:relative; } .schedule-date { color: #ffffff; text-align: center; margin-top: 0; padding-top: 3px; font: Calibri; font-size: 18px; } .schedule-title { font-size: 14px; font-weight: bold; text-align: left; } .schedule-other { font-size: 12px; padding-bottom: 3px; } .schedule-ul { position:relative; margin-top:10px; height:550px; list-style:none; padding-left: 10px; } .schedule-ul li a { text-decoration: none; color:#0d5887; } .schedule-ul li a:hover { text-decoration:underline; } Javascript $(document).ready(function () { var $item = $('div#schedule-background-overall'); $('div#schedule-button-right').click(function () { $item.animate({ 'left': '-=160px' }, 'slow'); }); $('div#schedule-button-left').click(function () { $item.animate({ 'left': '+=160px' }, 'slow'); }); }); To make it easier here is the code in [jsfiddle.net][1] [1]: http://jsfiddle.net/stanley1943/W7PMS/ Again, Thank you!!! --------------------------Solved--------------------- Didnt load library! Thanks for your help everyone!
You should post your solution as an answer for the benefit of future readers and then accept it.

以上就是Issue with div scroll left and right javascript的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏