
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.88 KB | hits: 11 | expires: Never
jquery whole page/window slider
step = (id) ->
width = $(window).width()
dir = 1
dir = -1 if id < curId
curId = id
$(".boxDisplay").animate
left: -1 * dir * width
, 500, "swing", ->
$(this).css "left", 0
$(this).removeClass "boxDisplay"
next = $(".box:eq(" + (id - 1) + ")")
next.addClass "boxDisplay"
boxPosition()
next.css "left", dir * width
next.animate
left: 0
, 500, "swing"
animate = ->
i = 0
$(".box").animate(
left: -50
, 10).animate(
left: 0
, 50).animate(
left: 50
, 10).animate(
left: 0
, 50).animate(
left: -25
, 10).animate(
left: 0
, 50).animate(
left: 25
, 10).animate(
left: 0
, 50).animate
left: 0
, 800
boxPosition = ->
height = $(".boxDisplay").height()
$(".box").css "margin-top", ($(window).height() / 2) - (height / 2)
$(document).ready ->
boxPosition()