Javascript jQuery.click++;符号

Javascript jQuery.click++;符号,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我在试着理解一个codrops。它本质上是一个带有拇指滚动条的滑块 我在代码中达到了这样一个点,他们在thumb scroller中设置变量来表示单击的项目,如下所示 var $currentTitle = $pg_title.find('h1:nth-child('+(current+1)+')'); var $nextTitle = $pg_title.find('h1:nth-child('+(idx+1)+')'); var $currentThu

我在试着理解一个codrops。它本质上是一个带有拇指滚动条的滑块

我在代码中达到了这样一个点,他们在thumb scroller中设置变量来表示单击的项目,如下所示

 var $currentTitle       = $pg_title.find('h1:nth-child('+(current+1)+')');

 var $nextTitle          = $pg_title.find('h1:nth-child('+(idx+1)+')');

 var $currentThumb       = $pg_preview.find('img.pg_thumb:eq('+current+')');

我从未见过这样的符号
+..+
。我一直在挖掘并找到人们在堆栈中使用它的示例,例如,但我没有看到任何人解释它。有人能解释一下
+…+
如何返回单击项的值吗

与字符串操作数一起使用时,它连接两个字符串。在本例中,创建选择器。与数字一起使用时,它用作加法运算符。这两种方法在这里都有使用。因此,如果
current==1

h1:n子级('+(当前+1)+')
'将首先计算为
h1:n子级('+2+')
,最终计算为
h1:n子级(2)

'+'用于字符串连接

$pg_title.find('h1:nth-child('+(current+1)+')');
比如:

如果要在“b”变量中添加其他字符串,则可以使用“+”进行串联

var addSomotherSting ='abc' +  b  + 'ghi'; 

alert(addSomotherSting);

然后浏览器显示一个带有“addSomotherSting”的警告框。
输出是:'abcdefghi'

这是一个简单的字符串连接如果你仔细看,他们正在使用字符串连接来构建选择器。
'h1:n子级('+(当前+1)+')
:创建一个类似于
h1:n子级(2)的字符串
where current=1对此我深表歉意,我错过了这里的球
var addSomotherSting ='abc' +  b  + 'ghi'; 

alert(addSomotherSting);