Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Shopify从其他页面的外部链接加载特定选项卡_Javascript_Jquery_Html_Tabs_Shopify - Fatal编程技术网

Javascript Shopify从其他页面的外部链接加载特定选项卡

Javascript Shopify从其他页面的外部链接加载特定选项卡,javascript,jquery,html,tabs,shopify,Javascript,Jquery,Html,Tabs,Shopify,您好,我在页面中使用这些shopify标签,而不是产品描述,来获取我的设计 这是我从以下地址收到标签的链接- 从注释粘贴的代码: window.onload = function() { $('ul.tabs).each(function(){ var openedHash = new URL(window.location.href).hash; links.first().removeClass('active'); content.hide(); active = $(

您好,我在页面中使用这些shopify标签,而不是产品描述,来获取我的设计

这是我从以下地址收到标签的链接-

从注释粘贴的代码:

        window.onload = function() {
$('ul.tabs).each(function(){
  var openedHash = new URL(window.location.href).hash;
links.first().removeClass('active');
content.hide();
active = $('a[href='+ openedHash + ']');
content = $($('a[href='+ openedHash + ']').attr('href'));
active.addClass('active');
content.show();
  });
  $(this).find('a').click(function(e){
active.removeClass('active');
content.hide();
active = $(this);
content = $($(this).attr('href'));
active.addClass('active');
content.show();
return false;
  });
    });

感谢您在重新加载站点后使用“获取活动”选项卡,您可以尝试使用
新URL(window.location.href).hash

可能是这样的

var openedHash = new URL(window.location.href).hash;
links.first().removeClass('active');
content.hide();
active = $('a[href='+ openedHash + ']');
content = $($('a[href='+ openedHash + ']').attr('href'));
active.addClass('active');
content.show();

在哪里添加此代码?当我替换“var active,content,links=“…etc”时,整个选项卡区域现在不工作。单击浏览器URL中的
后,您就有了
#tab-3
?它会中断选项卡的工作,因此我无法尝试任何操作。这就好像它停止了所有的工作,我现在甚至不能使用标签。这基本上是页面顶部示例中的代码。我正在使用的链接。我没有编辑它。只是更改了类名。这就是我使用的。shopify是付费的吗?我无法使用这个工具
var active, content, links = $(this).find('a');
  active = links.first().addClass('active');
  content = $(active.attr('href'));
  links.not(':first').each(function () {
    $($(this).attr('href')).hide();
  });
        window.onload = function() {
$('ul.tabs).each(function(){
  var openedHash = new URL(window.location.href).hash;
links.first().removeClass('active');
content.hide();
active = $('a[href='+ openedHash + ']');
content = $($('a[href='+ openedHash + ']').attr('href'));
active.addClass('active');
content.show();
  });
  $(this).find('a').click(function(e){
active.removeClass('active');
content.hide();
active = $(this);
content = $($(this).attr('href'));
active.addClass('active');
content.show();
return false;
  });
    });
var openedHash = new URL(window.location.href).hash;
links.first().removeClass('active');
content.hide();
active = $('a[href='+ openedHash + ']');
content = $($('a[href='+ openedHash + ']').attr('href'));
active.addClass('active');
content.show();