Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/397.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
简单javascript“;特写“;面板_Javascript_Jquery - Fatal编程技术网

简单javascript“;特写“;面板

简单javascript“;特写“;面板,javascript,jquery,Javascript,Jquery,我正在制作一个免费的模板,它有一个特色的Div www.subigya.com/test/durbarsquare “在聚光灯下”是特辑 我有简单的jqueryjs在那里切换图像。如何切换与交换机中每个div相关的标题&。现在,只有图像切换,而不是文本 使用的脚本是feature.js,样式表是style.css,来自您的脚本: $("#spotlightright a").click(function(){ //these two assignments are fine, because "

我正在制作一个免费的模板,它有一个特色的Div

www.subigya.com/test/durbarsquare

“在聚光灯下”是特辑

我有简单的jqueryjs在那里切换图像。如何切换与交换机中每个div相关的标题&。现在,只有图像切换,而不是文本

使用的脚本是feature.js,样式表是style.css,来自您的脚本:

$("#spotlightright a").click(function(){
//these two assignments are fine, because "href" and "title" are both attributes of "a" tags
    var largePath = $(this).attr("href");
    var largeAlt = $(this).attr("title");

//these two are not, an "a" does not have "h2" and "p" attributes
    var featureHead = $(this).attr("h2");
    var featureText = $(this).attr("p");
解决方案:直接引用包含您试图复制的文本的元素,例如

var featureHead = $('h2#example').text();
var featureText = $('p#example').text();

如果没有代码,那么帮助你就太麻烦了,提供他链接到脚本的代码和断开的示例,这还不够吗?太棒了!那么,如果这就是我引用元素的方式,那么在引用之后我如何实现它们呢?同样,由于每个“this”项都有单独的“h3”和“p”元素,它们不应该在一个循环中吗?