• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 871
  • Last Modified:

Zepto not working

Hi I'm trying out the zepto.js library because it's so small...

I wrote the simplest line:

$('#content').animate({opacity: 0.25}, 0.5);

But it doesn't work, nothing happens?
0
intoxicated_curveball
Asked:
intoxicated_curveball
  • 2
1 Solution
 
hieloCommented:
> $('#content').animate({opacity: 0.25}, 0.5);
the duration should be in milliseconds.  You probably meant 0.5 secs. If that is the case try:
$('#content').animate({opacity: 0.25}, 500);//500millisecs=0.5secs

Also, make sure you call it once #content is ready/available:
Zepto(function($){
    $('#content').animate({opacity: 0.25}, 500);
});

Open in new window

0
 
intoxicated_curveballAuthor Commented:
Still doesn't work. I think it's the library failing, I might try another library, I don't think this one is very good?
0
 
hieloCommented:
It seems to be working for me (on firefox and chrome).
NOTE:
Target platforms
Safari 5+ (desktop)
Chrome 5+ (desktop)
Mozilla Firefox 4+
iOS 4+ Safari
Android 2.2+ Browser
Other WebKit-based browsers/runtimes
webOS 1.4.5+ Browser
BlackBerry Tablet OS 1.0.7+ Browser
Amazon Silk 1.0+
Opera 10+

So, if you are testing in IE, it will not work. I used:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="zepto.js"></script>
<script type="text/javascript">
Zepto(function($){
    $('#content').animate({opacity: 0.25}, 500);
});
</script>

</head>
<body>
	<div id="content">Hello</div>
</body>
</html>

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now