如何在asp.net中添加以下功能到图像 [英] how to add below function to image in asp.net

查看:67
本文介绍了如何在asp.net中添加以下功能到图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我在asp.net开发了一个图片库..因为我已经在头部分写了下面的代码..现在我想写为asp image1 ..所以如何更改脚本asp.net



我的剧本:

 <   script     type   =  text / javascript    charset   =  utf-8 >  
$( document )。ready( function (){
$( a [rel ^ ='prettyPhoto']) .prettyPhoto();
});
< / script asp.com文件中的>

;;
< a < span class =code-attribute> href =' <% #Eval( 名称 admin / galimg / {0})%>' rel = prettyPhoto [pp_gal] title = 图库 >
< < span class =code-leadattribute> img src =' <% #Eval( 名称 admin / galimg / {0})%>' class = img_gallery alt =' <% #Eval( 名称)%>' / >
< / a >

< asp:Image ID = Image1 runat = server class = img_gallery ImageUrl =' <% #Eval( imagepath)%>' / >

解决方案

document )。ready( function (){


a [rel ^ ='prettyPhoto'])。prettyPhoto();
});
< / script asp.com文件中的>

;;
< a < span class =code-attribute> href =' <% #Eval( 名称 admin / galimg / {0})%>' rel = prettyPhoto [pp_gal] title = 图库 >
< < span class =code-leadattribute> img src =' <% #Eval( 名称 admin / galimg / {0})%>' class = img_gallery alt =' <% #Eval( 名称)%>' / >
< / a >

< asp:Image ID = Image1 runat = server class = img_gallery ImageUrl =' <% #Eval( imagepath)%>' / >


如果您再读一行这里的文档:

http:// www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/documentation [ ^ ]



您会知道:

只需将rel =prettyPhoto添加到您希望启用prettyPhoto的链接上。有关所有可能性,请参阅主项目页面上的演示。



所以你不想把rel属性放在你的图像上,但是在您的锚标签上。



所以你必须用正确的rel标签包装asp:Image到

例如:

 <   a     href   =     rel   =  prettyPhoto >  
< asp:图像 ID = Image1 runat = 服务器 class = img_gallery ImageUrl =' <% #Eval( imagepath%> ; ' / > ;
< / a >





另一种解决方案是更换选择器:

  

hi i am developed a image gallery in asp.net ..in that having hyperlink so i am write below code for that in header part..now i would like write for asp image1 ..so how to change the script in asp.net

my script:

<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$("a[rel^='prettyPhoto']").prettyPhoto();
});
</script> 
 
in aspx file;;
<a href='<%# Eval("Name","admin/galimg/{0}")%>' rel="prettyPhoto[pp_gal]" title="Gallery">
<img src='<%# Eval("Name","admin/galimg/{0}")%>' class="img_gallery" alt='<%# Eval("Name") %>' />
</a>
 
 <asp:Image ID="Image1" runat="server" class="img_gallery"  ImageUrl='<%# Eval("imagepath") %>' />

解决方案

(document).ready(function () {


("a[rel^='prettyPhoto']").prettyPhoto(); }); </script> in aspx file;; <a href='<%# Eval("Name","admin/galimg/{0}")%>' rel="prettyPhoto[pp_gal]" title="Gallery"> <img src='<%# Eval("Name","admin/galimg/{0}")%>' class="img_gallery" alt='<%# Eval("Name") %>' /> </a> <asp:Image ID="Image1" runat="server" class="img_gallery" ImageUrl='<%# Eval("imagepath") %>' />


if you would read one more line of documentation here:
http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/documentation[^]

You would know that:
"Just add rel="prettyPhoto" to the link you want prettyPhoto to be enabled on. Refer to the demos on the main project page for all the possibilities."

So you don't want to put rel attribute on you image, but on your anchor tag.

so you have to wrap asp:Image into anchor with correct rel tag
example:

<a href="#" rel="prettyPhoto"> 
<asp:Image ID="Image1" runat="server" class="img_gallery"  ImageUrl='<%# Eval("imagepath") %>' />
</a>



Another solution is to change your selector:


这篇关于如何在asp.net中添加以下功能到图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆