Javascript 手动编辑“的html”;带展开预览的缩略图网格";/更改.js?
我刚刚使用了本教程的缩略图网格和展开预览: 这与用于扩展预览内容的javascript生成集html代码一起使用。所以我不能手动编辑框的html,我只能填写标题、描述、图像和链接 是否有一种简单的方法来更改.js文件,即我总是必须手动编辑框的html? 作为一个示例,在html文件中如下所示:Javascript 手动编辑“的html”;带展开预览的缩略图网格";/更改.js?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我刚刚使用了本教程的缩略图网格和展开预览: 这与用于扩展预览内容的javascript生成集html代码一起使用。所以我不能手动编辑框的html,我只能填写标题、描述、图像和链接 是否有一种简单的方法来更改.js文件,即我总是必须手动编辑框的html? 作为一个示例,在html文件中如下所示: <li> <a href="#"> <img src="img/thumbnail1.png" alt="img01"/> &l
<li>
<a href="#">
<img src="img/thumbnail1.png" alt="img01"/>
</a>
<div>
Content
</div>
</li>
内容
在这个div中是框的内容,它在单击时显示
谢谢你的帮助
Philipp是的,您可以通过轻松更改负责呈现详细信息页面的功能来完成这一任务
Preview.prototype = {
create : function() {
// create Preview structure:
this.$title = $( '<h3></h3>' );
this.$description = $( '<p></p>' );
this.$href = $( '<a href="#">Visit website</a>' );
this.$details = $( '<div class="og-details"></div>' ).append( this.$title, this.$description, this.$href );
this.$myDiv = $( '<div class="my-div"></div>' ).append( "My Injected DIVVVVVVVVVVVVVVVVVVVVVVVVVVV" );
this.$loading = $( '<div class="og-loading"></div>' );
this.$fullimage = $( '<div class="og-fullimg"></div>' ).append( this.$loading );
this.$closePreview = $( '<span class="og-close"></span>' );
this.$previewInner = $( '<div class="og-expander-inner"></div>' ).append( this.$closePreview, this.$fullimage, this.$myDiv,this.$details);
this.$previewEl = $( '<div class="og-expander"></div>' ).append( this.$previewInner );
// append preview element to the item
this.$item.append( this.getEl() );
// set the transitions for the preview and the item
if( support ) {
this.setTransition();
}
},
Preview.prototype={
创建:函数(){
//创建预览结构:
此.$title=$('');
这个.$description=$(“”);
此。$href=$('');
this.$details=$('').append(this.$title,this.$description,this.$href);
此.$myDiv=$('').append(“我的注入divvvvvvvvvv”);
这是。$loading=$('');
this.$fullimage=$('').append(this.$loading);
此.$closePreview=$('');
this.$previewInner=$('').append(this.$closePreview,this.$fullimage,this.$myDiv,this.$details);
this.$previewWel=$('').append(this.$previewWinner);
//将预览元素附加到项目
this.$item.append(this.getEl());
//设置预览和项目的过渡
如果(支持){
这个.setTransition();
}
},
查看我是如何注入新div的,它在详细信息页面上可见,如下所示。
谢谢你的快速回答。但是是否可以手动编辑每个框的html。每个框中都有另一个html代码?不,原因是这些htmls div是通过js动态生成的。是的,我看到了。但是你不能在.js中写它应该从html中不可见的div中获取div的内容?或者可能吗可以重写完整的js,这样它只是动画,您可以手动填充它?可以保持它的可编辑性。这。$myDiv=$('').append(“My Injected Divvvvvv”);