[英]Need help modifying this to load internal hidden content
Okay, so I have this script that loads external files but now I want to modify it so that it loads internally hidden content. 好的,所以我有这个脚本可以加载外部文件,但是现在我想对其进行修改,以便加载内部隐藏的内容。 Can someone please help me with this.
有人可以帮我吗 There's two part to this script: 1) when someone clicks on a certain link with the class "o-links" it slides open displaying the requested content.
该脚本有两个部分:1)当某人单击带有“ o-links”类的某个链接时,它会滑动打开以显示所请求的内容。 Then there's the other link (o-close-link) that closes the previously slide open display area.
然后,另一个链接(o-close-link)关闭了以前的幻灯片打开显示区域。
Also I've been trying to add a gif loader but with no luck. 我也一直试图添加一个gif加载器,但是没有运气。 I just really want this to work, but I've tried to no avail.
我只是真的想要这个工作,但是我没有用。 Please help me fix this someone, anyone.
请帮助我解决此问题,任何人。 Please!
请!
$(document).ready(function() {
$('.o-links').click(function() {
var href = $(this).attr('href');
$.get(href, function(data){
$('.reserved-area').hide('fast');
$('.reserved-area').html(data).slideDown('slow');
});
return false;
});
$('.o-close-link').click(function() {
var href = $(this).attr('href');
$.get(href, function(data){
$('.reserved-area').hide('fast');
$('.reserved-area').html(data).slideDown('slow');
});
return false;
});
});
With this solution you shoud be able to load the content of a hidden element into your .reserved-area
by referencing the id of the hidden element in the href of the corrosponding link: 使用此解决方案,您应该能够通过在相应链接的href中引用隐藏元素的ID,将隐藏元素的内容加载到
.reserved-area
。
$('.o-links').click(function() {
// href has to be the id of the hidden content element
var href = $(this).attr('href');
$('.reserved-area')
.hide('fast')
.html($(href).html())
.slideDown('slow');
return false;
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.