- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有人知道如何将这些“添加到购物车”按钮居中吗?
元素在这里:https://codepen.io/amberbydesign/pen/pdovpL
下面的代码是 Shopify 为链接到外部 JS 文件的 1 if 3 按钮生成的代码。
(我尝试添加 - display: block; margin: 0 auto; 到按钮,但它仍然不起作用)
(function () {
var scriptURL = 'https://sdks.shopifycdn.com/buy-button/latest/buy-button-storefront.min.js';
if (window.ShopifyBuy) {
if (window.ShopifyBuy.UI) {
ShopifyBuyInit();
} else {
loadScript();
}
} else {
loadScript();
}
function loadScript() {
var script = document.createElement('script');
script.async = true;
script.src = scriptURL;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script);
script.onload = ShopifyBuyInit;
}
function ShopifyBuyInit() {
var client = ShopifyBuy.buildClient({
domain: 'neriumskincare-jp.myshopify.com',
apiKey: 'a8fcda28a0b70b31bbea1f51003e2dd9',
appId: '6',
});
ShopifyBuy.UI.onReady(client).then(function (ui) {
ui.createComponent('product', {
id: [8038986699],
node: document.getElementById('product-component-5d341381aec'),
moneyFormat: '%24%7B%7Bamount%7D%7D',
options: {
"product": {
"variantId": "all",
"width": "240px",
"contents": {
"img": false,
"imgWithCarousel": false,
"title": false,
"variantTitle": false,
"price": false,
"description": false,
"buttonWithQuantity": false,
"quantity": false
},
"styles": {
"product": {
"text-align": "left",
"@media (min-width: 601px)": {
"max-width": "100%",
"margin-left": "0",
"margin-bottom": "50px"
}
},
"button": {
"background-color": "#a1d2e6",
"font-family": "Lato, sans-serif",
"font-size": "15px",
"padding-top": "15.5px",
"padding-bottom": "15.5px",
"padding-left": "15px",
"padding-right": "15px",
":hover": {
"background-color": "#91bdcf"
},
":focus": {
"background-color": "#91bdcf"
},
"font-weight": "bold"
},
"quantityInput": {
"font-size": "15px",
"padding-top": "15.5px",
"padding-bottom": "15.5px"
},
"compareAt": {
"font-size": "12px"
}
},
"googleFonts": [
"Lato"
]
},
"cart": {
"contents": {
"button": true
},
"text": {
"title": "Your Shopping Cart",
"empty": "Your cart is empty"
},
"styles": {
"button": {
"background-color": "#a1d2e6",
"font-family": "Lato, sans-serif",
"font-size": "15px",
"padding-top": "15.5px",
"padding-bottom": "15.5px",
":hover": {
"background-color": "#91bdcf"
},
":focus": {
"background-color": "#91bdcf"
},
"font-weight": "bold"
},
"footer": {
"background-color": "#ffffff"
}
},
"googleFonts": [
"Lato"
]
},
"modalProduct": {
"contents": {
"img": false,
"imgWithCarousel": true,
"variantTitle": false,
"buttonWithQuantity": true,
"button": false,
"quantity": false
},
"styles": {
"product": {
"@media (min-width: 601px)": {
"max-width": "100%",
"margin-left": "0px",
"margin-bottom": "0px"
}
},
"button": {
"background-color": "#a1d2e6",
"font-family": "Lato, sans-serif",
"font-size": "15px",
"padding-top": "15.5px",
"padding-bottom": "15.5px",
"padding-left": "15px",
"padding-right": "15px",
":hover": {
"background-color": "#91bdcf"
},
":focus": {
"background-color": "#91bdcf"
},
"font-weight": "bold"
},
"quantityInput": {
"font-size": "15px",
"padding-top": "15.5px",
"padding-bottom": "15.5px"
}
},
"googleFonts": [
"Lato"
]
},
"toggle": {
"styles": {
"toggle": {
"font-family": "Lato, sans-serif",
"background-color": "#a1d2e6",
":hover": {
"background-color": "#91bdcf"
},
":focus": {
"background-color": "#91bdcf"
},
"font-weight": "bold"
},
"count": {
"font-size": "15px"
}
},
"googleFonts": [
"Lato"
]
},
"productSet": {
"styles": {
"products": {
"@media (min-width: 601px)": {
"margin-left": "-20px"
}
}
}
}
}
});
});
}
})();
/*]]>*/
最佳答案
display: block;
margin: 0 auto;
即使在您的 codepen 中也为我工作。
关于javascript - 以 Shopify 的购买按钮为中心的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47044688/
我正在为 Shopify 构建一个应用程序。我的商店以欧元为基础货币,并支持不同的货币,例如美元、新西兰元……(我将其称为活跃货币)。 我可以使用 javascript window.Shopify.
Shopify 的 documentation显示产品句柄中允许的一些字符(URL 中使用的产品标识符)。 Since handles are used for your storefront nav
如何检查当前页面是否是 theme.liquid 中的购物车页面?我试过 page.handle=='cart'但它不起作用。 最佳答案 您不需要 handle过滤器,你可以只使用: {% if te
我正在考虑为 Shopify 开发一个应用程序,它将向商店的结帐页面添加功能。如果用户不必自己将代码复制并粘贴到文件中,那将是理想的,因此我正在考虑使用 ScriptTag API ( http://
我正在为 Shopify 开发一个应用程序。目前处于开发阶段。到目前为止,我已经成功地授权了该应用程序,然后使用嵌入式应用程序 SDK 将其重定向回管理页面。但是,当我返回到管理页面时,它给我一个错误
我想知道 Shopify 中的实体可以拥有的元字段数量有何限制。例如,在产品对象的给定 namespace 下,您可以拥有 1000 个唯一的键值对吗?有硬性限制吗? 请注意,我已经查阅了 Shopi
有没有办法将 Shopify 购物车中的“继续结账”按钮重定向到另一个系统来处理销售?事实上,开发人员/设计师无法参与销售流程的最后一部分,这意味着即使是最轻微的变化也会成为无法克服的问题。有谁知道是
我正在开发一个集成 Shopify 的模块。 所以我想用真实数据测试我的应用程序。 Shopify 是否提供沙盒功能? 最佳答案 如果您创建 partners account您可以设置一个测试商店,让
我想知道 Shopify 中的实体可以拥有的元字段数量有何限制。例如,在产品对象的给定 namespace 下,您可以拥有 1000 个唯一的键值对吗?有硬性限制吗? 请注意,我已经查阅了 Shopi
我正在尝试检索博客上的最新文章。我下面的当前代码不输出任何内容。 {% for article in blogs['myblog'].articles.last %} {{ article.tit
我试图在我的节文件中使用一个变量,但它似乎没有从它的父模板继承。 例如: index.liquid {% assign foo = "bar" %} {% section 'example' %} s
我正在尝试编写一些代码来估计 Shopify 中的发货日期。我一直在学习 liquid,但在用 Ruby 编写一些逻辑时遇到了问题。我不确定 Shopify 模板是使用 Ruby 还是 Ruby on
我正在尝试为我的客户生成一个注销链接,但想为该链接应用一个类。 {{ 'layout.customer.log_out' | t | customer_logout_link }} 上面的liquid
我有 Shopify 商店,客户可以在购买前设计/定制他们的产品。并且根据所选变体的设计/定制价格可能会有所不同。但我认为 Shopify 不便于在添加到购物车时动态更改变体价格。 我可能缺少任何解决
我做了以下事情: 创建合作伙伴帐户 创建了一个开发商店 创建了一个应用。 但我似乎找不到将我的应用程序添加到我的开发商店的方法。有人可以解释一下如何将它添加到我的开发商店而不将其放入应用商店吗? 最佳
当我在 Shopify 中循环访问一个集合时,我想将该产品添加到另一个产品数组中,以便我可以再次循环访问它。 {% assign custom_products = '' %} {% for prod
我需要在 shopify 产品页面上添加自定义文本框字段。 我的要求是在产品页面上添加文本框字段,当客户在购物车中添加产品时,该文本框字段值也会显示在购物车页面和结帐页面上。 我还需要在管理员自定义订
与 Shopify API您可以设置输入字段供用户调整主题,例如: { "type": "number", "id": "products_per_page", "label": "Pro
我想为我的 shopify 应用程序使用 Polaris css 组件。我看过他们的文件 https://polaris.shopify.com/components/get-started#navi
我是 Shopify 的新手,我正在尝试配置现有主题并遵循此处指南 (https://shopify.github.io/themekit/) 的完整流程,但是当我尝试运行命令主题下载时,它显示了错误
我是一名优秀的程序员,十分优秀!