Ninja Cowgirl
Ninja Cowgirl

Reputation: 11261

jquery to display thumbnail. not working

This jQuery should give me thumbnail view but it does not. Any idea what I am doing wrong? It just gives me the sharepoint icjpg.gif in bigger size.

<SCRIPT language=javascript src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type=text/javascript></SCRIPT> 

<SCRIPT defer type=text/javascript> 
$(document).ready(function(){ 
$("img[src$='icjpg.gif']").each(SetImage); 

}); 
function SetImage() 
{ 

$(this).attr('height','100'); 
$(this).attr('src',$(this).parent().attr('href')); 

} 
</SCRIPT>

Upvotes: 2

Views: 299

Answers (2)

Ninja Cowgirl
Ninja Cowgirl

Reputation: 11261

Following code works. You have to put in the relative url to the library

<script type="text/javascript">
$(document).ready(function(){
$("img[src$='icjpg.gif']").each(SetImage);

});
function SetImage()
{
    $(this).attr('height','100');
    $(this).attr('src','/managedpath/sitename/library/'+$(this).attr('title'));
}
</script>

Upvotes: 1

void
void

Reputation: 36703

<script type=text/javascript> 
$(document).ready(function(){ 
$("img[src*=icjpg.gif]").each(SetImage); 

}); 
function SetImage() 
{ 

$(this).css({'height':'100px', "width":"auto"}); 
$(this).attr('src',$(this).parent().attr('href')); 

} 
</script>

Upvotes: 1

Related Questions