用jquery制作滑块

发布于 2024-12-25 08:41:01 字数 185 浏览 1 评论 0原文

Example

我需要一个由三组组成的滑块,内部有 3 个滑块。它将开始滑动第一组 (1-2-3),并在显示第二组后......循环所有。滑块应在鼠标悬停时暂停并显示文章,并且单击时将显示组。有人可以推荐这样的滑块吗?

谢谢

Example

I need a slider that is composed of three groups with 3 slider inside. It will start sliding the first group (1-2-3) and after show second group... cycling all. The slider should pause on mouse over and show article and the groups will show on click. Can anyone suggest slider like this?

Thank You

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

戴着白色围巾的女孩 2025-01-01 08:41:01

你可以为此构建一些处理程序,就像 jquery lib:

js function:

function screenThis(page){
$('#screen').hide("fast");
$('#screen').load("handler.php?p="+page).show();
//you can add some effects on this fcn
}

handler.php 可以像这样:

<?php
$page = @$_GET["p"];
$content = ''; //init
$q = mysql_query("select * from pages where id = '$page' ");
while($r = mysql_fetch_array($q)){
$content = $r['content'];
}
if ($content != '') echo $content;
?>

并且菜单的 html 代码可以像这样:

<a href="#" onclick="screenThis(somenumber/orpageid)">Article 1</a>
<a href="#" onclick="screenThis(somenumber/orpageid)">Article 2</a>
<a href="#" onclick="screenThis(somenumber/orpageid)">Article 3</a>

you can build some handler for this, just as with jquery lib:

js function:

function screenThis(page){
$('#screen').hide("fast");
$('#screen').load("handler.php?p="+page).show();
//you can add some effects on this fcn
}

handler.php can be like this:

<?php
$page = @$_GET["p"];
$content = ''; //init
$q = mysql_query("select * from pages where id = '$page' ");
while($r = mysql_fetch_array($q)){
$content = $r['content'];
}
if ($content != '') echo $content;
?>

and html code for your menu can be like this:

<a href="#" onclick="screenThis(somenumber/orpageid)">Article 1</a>
<a href="#" onclick="screenThis(somenumber/orpageid)">Article 2</a>
<a href="#" onclick="screenThis(somenumber/orpageid)">Article 3</a>
苄①跕圉湢 2025-01-01 08:41:01

这是您正在寻找的一种非常特殊的滑块,所以我认为您必须自己进行编码。

我建议使用像 EasySlider 这样的滑块(基本的、从难到复杂的东西)或 SudoSlider (更多功能,陡峭的学习曲线)来进行滑动。两者都支持嵌套滑块。

然后自己构建所有控件,并将它们绑定到一些 jQuery 代码来处理滑动逻辑(滑动逻辑触发滑块)。相同的代码当然应该处理“自动滑动”。

在构建自动滑动时,我会列出代码将执行的所有“步骤”,如下所示:{{1,1},{1,2},{1,3},{2,1}, {2,1}, {2,2}, {2,3} ... } 以便告诉脚本接下来每 X 秒应该做什么。

希望你能让它发挥作用。

It is a very specific kind of slider you are looking for, so i think you have to do the coding yourself.

I would suggest using a slider like EasySlider (basic, hard to to complicated stuff) or SudoSlider (more features, steep learning curve) to make the sliding. Both support nested sliders.

Then build all of the controls yourself, and bind them to some jQuery code to handle the sliding logic (the sliding logic triggers the sliders). The same code should of course handle the "automatic sliding".

When building the automatic sliding, i would make a list of all the "steps" the code will make, like this: {{1,1}, {1,2}, {1,3}, {2,1}, {2,1}, {2,2}, {2,3} ... } in order to tell the script what it should do next every X seconds.

Hope you can get it to work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文