我有一个jquery函数,在元素循环中的每个元素上显示隐藏的内容.这工作完美,但问题是当我将新元素添加到循环时它停止工作.它实际上适用于某些元素,而不适用于其他元素(奇怪的行为).
<script type="text/javascript">
jQuery(document).ready(function($) {
$(".see_all").click(function(){
if ($(this).next().css('display') == 'none'){
$(this).next().show();
}
else
if($(this).next().is(':visible')){
$(this).next().hide();
}
});
})
</script>
Run Code Online (Sandbox Code Playgroud)
我的jquery代码有问题吗?如何使它适用于新添加的元素和以前显示的元素.
HTML代码
<div class="center_container">
<%for users in @user%>
<div class="see_all">
<span style="color:#808080;cursor:pointer">See All Reviews(<%=@beep_count= (@beep.opposes.count + @beep.neutrals.count + @beep.supports.count)%>)</span>
</div>
<div style="display:none;" class="hidden">
No reviews available
</div>
<%end%>
</div>
Run Code Online (Sandbox Code Playgroud) 我想在vexxhost上第一次部署我的rails应用程序.我使用github作为我的源代码管理和capistrano.
这是我的部署文件
require 'bundler/capistrano'
require 'capistrano'
require 'bundler'
require 'capistrano-vexxhost'
# Account Settings
ssh_options[:forward_agent] = true
set :scm_command, "/home/user/opt/bin/git"
set :local_scm_command,"git"
set :user, "xxxxxxxx"
set :password, "xxxxxxxxx"
set :domain, "domain.com"
set :mount_path,"/home/xxxxxxxx/xxxxxxx"
set :application,"app name"
set :scm, :git
set :deploy_via, :copy
set :repository, "git@github.com:xxxxx/xxxxxxx.git"
default_run_options[:pty] = true
Run Code Online (Sandbox Code Playgroud)
一旦我安装了gem'capistrano'gem'capistrano-vexxhost',我在尝试在我的笔记本电脑上本地加载我的应用程序时遇到以下错误(它在安装capistrano之前工作).
C:/Ruby193/lib/ruby/gems/1.9.1/gems/capistrano-2.14.1/lib/capistrano/configuration/loading.rb:18:in `instance': Please require this file from within a Capistrano recipe (LoadError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/capistrano.rb:7:in `<top (required)>'
from C:/Users/mummy/LagoAds/config/application.rb:6:in `require'
from C:/Users/mummy/LagoAds/config/application.rb:6:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>' …Run Code Online (Sandbox Code Playgroud)