小编Aru*_*nan的帖子

如何知道何时加载特定"div"中的所有图像?

我的HTML页面的一部分如下div:

<div id="images_wrapper">
  <img ... />
  <img ... />
  <img ... />
  ...
</div>
Run Code Online (Sandbox Code Playgroud)

最初,这div是隐藏的,我只在加载所有图像时显示它:

$(window).load(show_images_wrapper);
Run Code Online (Sandbox Code Playgroud)

但是,如果我没有弄错,show_images_wrapper只有在加载所有页面时才会调用.我想show_images_wrapper在内部所有图像images_wrapper加载后立即调用,并且不要等到所有页面都加载完毕.

我试过了:

$("#images_wrapper").load(show_images_wrapper);
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

我该怎么做?

html javascript jquery javascript-events

17
推荐指数
2
解决办法
6803
查看次数

使用方法扩展Ruby String类以更改内容

我试图像这样扩展ruby字符串类:

String.class_eval do
  def clear!
    # Here I want the string value to be set to empty string. The following code is not working.
    self = ''
  end
end
Run Code Online (Sandbox Code Playgroud)

ruby

3
推荐指数
1
解决办法
4543
查看次数

Rails Devise发送邮件

我是通过铁路发送邮件的新手.我在项目实施的装置和后现在我想发送欢迎电子邮件和/或密码重置邮件.我需要在Devise视图中做出哪些更改?没有显示错误,但我仍然没有收到任何电子邮件.

我已经按照这些链接,最后我的devise.rb,development.rb和production.rb文件如下:

=== devise.rb ===

 config.mailer_sender = "xxx@gmail.com"
Run Code Online (Sandbox Code Playgroud)

=== development.rb ==

  config.action_mailer.raise_delivery_errors = false

  config.action_dispatch.best_standards_support = :builtin

  config.active_support.deprecation = :notify
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = false
  config.action_mailer.raise_delivery_errors = true

  config.action_mailer.default :charset => "utf-8"


  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  config.active_support.deprecation = :log

 config.action_mailer.smtp_settings ={
 :enable_starttls_auto => true,
 :address            => 'smtp.gmail.com',
 :port               => 587,
 :tls                => true,
 :domain             => 'gmail.com',
 :authentication     => :plain,
 :user_name          => 'xxx@gmail.com',
 :password           => 'xxxxxx' 
 }

 =====production.rb===
 config.action_mailer.default_url_options = { :host => 'gmail.com' }

  config.active_support.deprecation = …
Run Code Online (Sandbox Code Playgroud)

email ruby-on-rails send devise

2
推荐指数
1
解决办法
8183
查看次数