我使用mailchimp来让用户在我的网站上签署新闻通讯。我只是意识到mailchimp需要140kb的空间,这几乎是我的目标网页加载量的10%。
<!-- Begin MailChimp Signup Form -->
<div class=" col-sm-8 col-sm-offset-2 col-xs-12 onewayDistance" ng-class="{'col-md-8 col-md-offset-2': !newsletterModal,'col-md_8':newsletterModal}" >
<!--link href="//cdn-images.mailchimp.com/embedcode/classic-081711.css" rel="stylesheet" type="text/css"-->
<div id="mc_embed_signup" >
<form action="//tripdelta.us8.list-manage.com/subscribe/post?u=9a2a27b15c44950e3ba360a28&id=9b656d6732" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div class="row">
<div class="col-xs-12 " id="stayInformed">
{{'STAY_INFORMED'|translate}} <span>{{'NEWSLETTER'|translate}}</span>
</div>
<div class="col-xs-9 col-md-4 col-md-offset-3 mc-field-group ">
<input type="email" ng-model="userEmail" placeholder="{{'ENTER_EMAIL'|translate}}" name="EMAIL" class="required email" id="mce-EMAIL">
<div id="mce-responses" class="clear" style="background-color: rgba(255,255,255,0.6)">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;">
<input type="text" name="b_9a2a27b15c44950e3ba360a28_9b656d6732" tabindex="-1" value="">
</div>
</div>
<div class="col-xs-3 col-md-2" id="newsletterButton">
<button type="submit" name="subscribe" id="mc-embedded-subscribe" ng-class="{'newsletterModalColor':newsletterModal}" class="button">{{'SUBSCRIBE'|translate}}</button>
</div>
</div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'>
</script>
<script type='text/javascript'>
(function($) {
window.fnames = new Array();
window.ftypes = new Array();
fnames[0]='EMAIL';
ftypes[0]='email';
}(jQuery));
var $mcj = jQuery;
</script>
</div>
这只是普通的代码,我只是从他们的网站复制并做了一些CSS更改。有机会最小化要加载的此数据量吗?
最佳答案
似乎从这里下载了JQuery API:
//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js
因此,如果您的网站已经使用JQuery,则也许不必放这个。
但是似乎他们已经对其进行了修改(我不知道到底是什么被修改,但似乎您看过所有代码)。
我现在想不出另一种减小尺寸的方法:/
关于jquery - Mailchimp需要140kb才能加载,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29739369/