本文介绍了使用jQuery向左/向右滑动div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在多个位置向左/向右滑动找到以下代码:
I found following code in multiple places to slide left/right:
$('#hello').hide('slide', {direction: 'left'}, 1000);
但是,我无法正常工作.这是我正在尝试的简约测试:
However, i can't get it working. Here is minimalistic test which I am trying:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
$("#test").click(function() {
$('#hello').hide('slide', {direction: 'left'}, 1000);
});
});
</script>
</head>
<body>
<article >
<div id="hello">
Hello
</div>
<p><span id="test">Test</span>
</arcticle>
</body>
我在Chrome和Safari中尝试过,但无法正常工作.
I tried it in Chrome and Safari and it doesn't work.
出什么问题了?还有其他向左/向右滑动的工作方法吗?
What is the problem? Are there other working methods to slide left/right?
推荐答案
$('#hello').hide('slide', {direction: 'left'}, 1000);
需要jQuery-ui库.请参见 http://www.jqueryui.com
$('#hello').hide('slide', {direction: 'left'}, 1000);
requires the jQuery-ui library. See http://www.jqueryui.com
这篇关于使用jQuery向左/向右滑动div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!