dongre6404 2010-12-17 00:41
浏览 57
已采纳

Mod重写页面锚点

I've been trying to solve this for the past two hours. I already tried every solution mentioned on google, but without any luck.

Let's start with the problem. I'm trying to use this plugin: http://www.gethifi.com/blog/a-jquery-plugin-to-create-an-interactive-filterable-portfolio-like-ours

on my website. The problem is that this plugin is using Anchor tags. Without it, it doesn't seem to work. Well, I'm trying to work with User Friendly URL's on the website I'm working on right now. So the anchors are not working.

This is my .htaccess file right now:

RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)\.html$ /mysite/category.php?cat=$1 [L]
RewriteRule ^([^/]*)/([^/]*)\.html$ /mysite/category.php?cat=$1&lang=$2 [L]

Nothing fancy, just some rewrites for categories and languages. The only thing that seems to work is this:

RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)\.html$ /mysite/category.php?cat=$1 [L]
RewriteRule ^([^/]*)/([^/]*)\.html$ /mysite/category.php?cat=$1&lang=$2 [NE,R,L]

But my User Friendly URL is also gone when I use this. Instead I see: category.php?cat=....

I don't know if this is important but I use <base href=""> to point to the host I'm working on.

Thanks in advance for any ideas.

  • 写回答

2条回答 默认 最新

  • dpn68721 2010-12-17 15:15
    关注

    Couldn't find a way to make the plug-in work in combination with mod_rewrite, so I just gave up and used another plug-in. It seems to work find, since it doesn't need an anchor to work with.

    Peace.

    Edit:

    This is the code I'm using right now:

            $(document).ready(function() {
    
                $('.menu li a').click(function() {
    
    
                    $('.menu li').removeClass('selected');
                    $(this).parent('li').addClass('selected');
    
                    thisItem    = $(this).attr('rel');
    
                    if(thisItem != "all") {
    
                        $('.item li[rel='+thisItem+']').stop()
                                                                .animate({'width' : '110px', 
                                                                             'opacity' : 1, 
                                                                             'marginRight' : '.5em', 
                                                                             'marginLeft' : '.5em'
                                                                            });
    
                        $('.item li[rel!='+thisItem+']').stop()
                                                                .animate({'width' : 0, 
                                                                             'opacity' : 0,
                                                                             'marginRight' : 0, 
                                                                             'marginLeft' : 0
                                                                            });
                    } else {
    
                        $('.item li').stop()
                                        .animate({'opacity' : 1, 
                                                     'width' : '110px', 
                                                     'marginRight' : '.5em', 
                                                     'marginLeft' : '.5em'
                                                    });
                    }
                })
    
                $('.item li img').animate({'opacity' : 0.5}).hover(function() {
                    $(this).animate({'opacity' : 1});
                }, function() {
                    $(this).animate({'opacity' : 0.5});
                });
    
            });
    

    I just changed it from list to divs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 数学的三元一次方程求解
  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题