javascript 如何在电子邮件通讯中添加图像滑块?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30837190/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 12:46:13  来源:igfitidea点击:

How to add image slider in email newsletter?

javascriptjqueryhtmlemailnewsletter

提问by sandhu

I have been created email newsletter using mailchimp

我已经使用mailchimp创建了电子邮件通讯

Now i want to add image slider with responsive design,

现在我想添加响应式设计的图像滑块,

But i have been searched lot online..

但是我在网上搜索了很多..

Some online docs says can't able to add image slider in email newsletter.

一些在线文档说无法在电子邮件通讯中添加图像滑块。

For example this linktold., its impossible.

例如这个链接告诉。,这是不可能的。

So, may i know, what is the exact link, to achieve this one?

那么,我可以知道,实现这一目标的确切链接是什么?

Any help would be highly appreciated,

任何帮助将不胜感激,

Thanks in advance.

提前致谢。

回答by Roko C. Buljan

unfortunately you cannot do it. Neither CSS3 sliders nor JS sliders will work in HTML email.

不幸的是,你不能这样做。CSS3 滑块和 JS 滑块都不适用于 HTML 电子邮件。

NO-JS in Email newsletter. Proof?

电子邮件通讯中的 NO-JS。证明?

Inside the <head>of your email newsletter simply insert:

<head>您的电子邮件通讯中,只需插入:

<script>alert("JS WORKS! ...not");</script>

Sent that email - and that's your proof that Email Clients do not support JS

发送了那封电子邮件——这就是你证明电子邮件客户端不支持 JS 的证据



GIF animated image

GIF 动画图像

You could eventually go wit ha .gif animation. Will not work in Outlook 2007- but at least it'll show the first frame.
Don't exagerate with the .gif animations, since the more frames you use that bigger your file size.
Also don't forget that you're limited with the color palette(256) so think twice:

您最终可以使用 ha .gif 动画。在Outlook 2007 中不起作用- 但至少它会显示第一帧。
不要夸大 .gif 动画,因为您使用的帧越多,文件大小就越大。
也不要忘记您的调色板(256)有限,所以请三思:

You don't want the user to wait for 900KB .gif image.

您不希望用户等待 900KB .gif 图像。



JPG Static image

JPG 静态图片

enter image description hereMy suggestionis to create a calling and beautiful Slider-alike .jpg image.
Link itto your site where you present your products.

在此处输入图片说明我的建议是创建一个漂亮的Slider-alike .jpg 图像
将其链接到您展示产品的网站。

<a href="http://example.com/products"><img src="http://example.com/nl/img/img.jpg"></a>

This appealing image has just 45KB. Every Email Client will be happy to serve such image without blacklisting you.
Also, see your MailChimp Click-trough rate. Should lead to surprising results!

这个吸引人的图像只有45KB。每个电子邮件客户端都会很乐意为您提供此类图像,而不会将您列入黑名单。
此外,请参阅您的 MailChimp点击率。应该会导致出人意料的结果!

回答by Naguib Ihab

Imageslider would need a JS running, having inline js in the email is not possible because the email will be blocked by most email providers.

Imageslider 需要运行 JS,在电子邮件中使用内联 js 是不可能的,因为大多数电子邮件提供商都会阻止电子邮件。

However you can use a GIF image: https://litmus.com/blog/a-guide-to-animated-gifs-in-email

但是,您可以使用 GIF 图像:https: //litmus.com/blog/a-guide-to-animated-gifs-in-email

回答by HansDev

So javascript is not possible in emails like others have stated above. There are so many security reason for this...

所以javascript在电子邮件中是不可能的,就像上面其他人所说的那样。这有很多安全原因......

That being said you definitely CAN implement as image slider or more accurately an image carousel with pure html and css using checkbox/radio hacks. The support however isn't just limited to email clients but more significantly is limited by email services like mailchimp which do support sending emails because mailchimp Form elements including checkbox, radio and labels are stripped from emails...

话虽如此,您绝对可以使用复选框/无线电黑客实现图像滑块或更准确地实现具有纯 html 和 css 的图像轮播。然而,这种支持不仅限于电子邮件客户端,更重要的是受到像 mailchimp 这样支持发送电子邮件的电子邮件服务的限制,因为 mailchimp表单元素(包括复选框、收音机和标签)已从电子邮件中删除...

That being said here is an example:

这就是一个例子:

http://freshinbox.com/resources/tools/carousel/

http://freshinbox.com/resources/tools/carousel/