jQuery 可滚动的下一个/上一个按钮不能包裹在其他标签中

发布于 2024-08-24 01:30:19 字数 2250 浏览 6 评论 0 原文

我这里有一个可滚动的: http://treethink.treethink.net/portfolio/

我是尝试将 ap 标签放在 2 个 a 标签周围,导致可滚动来回移动,但无论我在 a 标签周围放置什么,它都会破坏滚动(span、div、p...它们都不起作用

)我可以解决这个问题吗?我认为这与可滚动中涉及的 jQuery 有关。

这是页面该部分的代码:

<div id="wrapper">

<div id="portfolio">

<div id="portfolio-main">

<div id="scroll">

<div class="scrollable">

<div id="thumbs">

<?php
   $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc&parent='.$post->ID);

   $i = 1;
   foreach( $pages as $page ) {
       $content = $page->post_title;
       if( empty($content) ) continue;

       $content = apply_filters('the_content', $content);

       ?>

<div class="column" style="background: url(/wp-content/uploads/<?php echo $page->post_name ?>.jpg);">
<div class="desc"><a href="<?php echo get_page_link($page->ID) ?>"><h2><?php echo $page->post_title ?></h2></a><p><?php if(get_post_meta($page->ID, "date", true)) { echo get_post_meta($page->ID, "date", true); ?><br /><?php } ?><?php echo get_post_meta($page->ID, "desc", true); ?></p></div></div>

<?php $i++;

   }    ?>

</div>

</div>

<a class="prev banner-button">prev</a>

<a class="next banner-button">next</a>

</div>

<br clear="all" />

<script>

$(function() {      

    $("div.scrollable").scrollable({
        size: 4,
        items: '#thumbs',  
        hoverClass: 'hover'
    }); 

});
</script>

</div>

</div>

</div>

这是我试图将其包装在其中的样式:

#main-buttons{
    height: 30px;
    width: 560px;
    top: 460px;
    right: 0;
    position: absolute;
    z-index: 1;
    text-align: right;
}

最后,这是包含可滚动内容的 jQuery 文件: http://treethink.treethink.net/wp-content/themes/treethink/scroll/jquery.tools .min.js

谢谢, 韦德

I have a scrollable going here: http://treethink.treethink.net/portfolio/

I am trying to put a p tag around the 2 a tags that cause the scrollable to move back and forth but no matter what I put around the a tags it breaks the scrolling (span, div, p...They all don't work)

How can I solve this? I assume it's something to do with the jQuery involved in the scrollable.

Here is the code for that section of the page:

<div id="wrapper">

<div id="portfolio">

<div id="portfolio-main">

<div id="scroll">

<div class="scrollable">

<div id="thumbs">

<?php
   $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc&parent='.$post->ID);

   $i = 1;
   foreach( $pages as $page ) {
       $content = $page->post_title;
       if( empty($content) ) continue;

       $content = apply_filters('the_content', $content);

       ?>

<div class="column" style="background: url(/wp-content/uploads/<?php echo $page->post_name ?>.jpg);">
<div class="desc"><a href="<?php echo get_page_link($page->ID) ?>"><h2><?php echo $page->post_title ?></h2></a><p><?php if(get_post_meta($page->ID, "date", true)) { echo get_post_meta($page->ID, "date", true); ?><br /><?php } ?><?php echo get_post_meta($page->ID, "desc", true); ?></p></div></div>

<?php $i++;

   }    ?>

</div>

</div>

<a class="prev banner-button">prev</a>

<a class="next banner-button">next</a>

</div>

<br clear="all" />

<script>

$(function() {      

    $("div.scrollable").scrollable({
        size: 4,
        items: '#thumbs',  
        hoverClass: 'hover'
    }); 

});
</script>

</div>

</div>

</div>

Here is the style I am trying to wrap it in:

#main-buttons{
    height: 30px;
    width: 560px;
    top: 460px;
    right: 0;
    position: absolute;
    z-index: 1;
    text-align: right;
}

And finally, here is the jQuery file that includes the scrollable stuff: http://treethink.treethink.net/wp-content/themes/treethink/scroll/jquery.tools.min.js

Thanks,
Wade

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

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

发布评论

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

评论(1

拧巴小姐 2024-08-31 01:30:19

试试这个:

<div id='prevnext'>
    <a class="next portfolio-button">next</a>
    <a class="prev portfolio-button">prev</a>
 </div>

和这个:

<script type="text/javascript">
$(function() {
    $("div.scrollable").scrollable({
        size: 4,
        items: '#thumbs',
        hoverClass: 'hover',
        next: "#prevnext .next",
        prev: "#prevnext .prev"
        });

    });
</script>

希望有帮助。

try this:

<div id='prevnext'>
    <a class="next portfolio-button">next</a>
    <a class="prev portfolio-button">prev</a>
 </div>

and this:

<script type="text/javascript">
$(function() {
    $("div.scrollable").scrollable({
        size: 4,
        items: '#thumbs',
        hoverClass: 'hover',
        next: "#prevnext .next",
        prev: "#prevnext .prev"
        });

    });
</script>

hope this help.

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