如何在加载内容上使用css? [英] How to chage the css on loaded content?
本文介绍了如何在加载内容上使用css?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这部分是静态内容
This part is static content
<div id="albums" class="clearfix"></div>
这部分是动态内容加载到#album div由jquery
This part is dynamic content load to #album div by jquery
<div class="album pull-left"><img src="XXX"/><img src="XXX"/><img src="XXX"/></div>
我想用jquery修改img的宽度。问题是我得到宽度的NaN值。
当点击img添加功能时,我知道我应该使用
$(文件).on('click','img',function(){...});
但是我不知道应该绑定什么事件。
I want to modify the width of img using jquery. The problem is I get NaN value of width.
When click the img to add function, I know I should use
$(document).on('click','img',function(){...});
But I don't know what event I should bind.
推荐答案
(文件).on('click','img',function(){...});
但我不知道是什么事件我应该绑定。
(document).on('click','img',function(){...});
But I don't know what event I should bind.
预计你想要在点击图像时修改图像宽度,
然后你可以使用图像id进行onclick事件。 />
即:
假设第一个图像标记的id是image1。
那么你可以使用: -
Anticipating that you want to modify the image width on click of the image,
Then you can use the image id for onclick event.
That is:
Suppose id for first image tag is image1.
then you can use:-
( #image1 ).click( function (){
("#image1").click(function(){
这篇关于如何在加载内容上使用css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文