我目前在此页面中有两个标签:
我想做的是,每当我导航到此页面时,我都希望该页面默认为打开Reviews
选项卡,而不是Description
选项卡。
将鼠标悬停在Description
选项卡上时,将看到此URL弹出localhost:8080/#tab-description
和localhost:8080/#tab-review
。
当我打开此页面时,我想链接到第二个选项卡,即#tab-review
,因为现在,默认选项卡是第一个选项卡,即#tab-description
。
重定向通过称为View
的order_info.tpl
进行,我使用了以下URL生成:<a href="<?php echo $product_url . $product['product_id'] . $tab_review; ?>" class="button"> FEEDBACK </a>
$product_url
是我在Controller中设置的URL,定义为http://someurl:8080/index.php?route=product/product&product_id=
,其中$product['product_id']
是产品ID,它是根据特定页面的产品ID动态确定的。
我尝试过的
我试图将#tab-review
锚添加到URL的末尾,但这不能解决我的问题,即http://192.168.16.34:8080/index.php?route=product/product&path=772_774&product_id=1791#tab-review
任何帮助,将不胜感激
最佳答案
您可以通过使用活动选项初始化小部件来设置选项卡。
$( "#tabs" ).tabs({
active: 1
});
或在初始化后进行设置:
$( "#tabs" ).tabs( "option", "active", 1 );
假设您正在使用jQuery UI tab widget
关于javascript - 导航到页面的特定 anchor ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27350538/