[英]How to override default template values in Zurb-Foundation within a Rails project
I need to override a paritcular javascript variable within Foundation 3.2.5 library. 我需要在Foundation 3.2.5库中覆盖一个偶发的javascript变量。 I need to do it in such a way I do not include the entire project just for this change. 我需要以不包含整个项目的方式进行更改。
The variable I am willing to override is in this particular file jquery.foundation.clearing.js 我愿意覆盖的变量在此特定文件jquery.foundation.clearing.js中
Snippet: 片段:
;(function ($, window, document, undefined) {
'use strict';
var defaults = {
templates : {
viewing : '<a href="#" class="clearing-close">×</a>' +
'<div class="visible-img" style="display: none"><img src="#">' +
'<p class="clearing-caption"></p><a href="#" class="clearing-main-left"></a>' +
'<a href="#" class="clearing-main-right"></a></div>'
},
close_selectors : 'a.clearing-close',
initialized : false,
locked : false
},
The full file is located here 完整文件位于此处
The variable I want to override is defaults.templates.viewing
. 我要覆盖的变量是defaults.templates.viewing
。 How to accomplish this smartly in Rails with minimal code change? 如何在Rails中以最少的代码更改巧妙地完成此任务? I tried to create a foundaiton_override.js file but I don't know how to access the specific variable directly from there and override it. 我试图创建一个foundaiton_override.js文件,但是我不知道如何直接从那里访问特定变量并覆盖它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.