This is the third and final post of the image preview series. Here is Part I and Part II.
I left off having a consistent search result from images both stored in picture libraries as well as a regular document libraries. The results show a preview on the page but the hover doesn't have a larger view. This is an easy fix.
UPDATE: Get the source files here
Showing a Preview Image in the Image Search Result Hover Panel
Problem
Hovering over the image search results does not show a larger preview image:
</div>
Save the file and refresh the search results. A larger image shows in the hover now:
If you do not have a Search Center site collection and only see .js files, here is the modification to the Item_Picture_HoverPanel.js:
,' <div id="', $htmlEncode(id + HP.ids.body) ,'" class="ms-srch-hover-body">'
,''
,' <div class="ms-srch-hover-imageContainer">'
,' <img id="', ctx.CurrentItem.csr_id ,'" src="', $urlHtmlEncode(ctx.CurrentItem.Path) ,'" onload="this.style.display=\'block\';" />'
,' </div>'
,' '
);
if(!Srch.U.n(ctx.CurrentItem.PictureURL)){
I left off having a consistent search result from images both stored in picture libraries as well as a regular document libraries. The results show a preview on the page but the hover doesn't have a larger view. This is an easy fix.
UPDATE: Get the source files here
Showing a Preview Image in the Image Search Result Hover Panel
Problem
Hovering over the image search results does not show a larger preview image:
Solution
Modify the Item_Picture_HoverPanel.html file and add the following code right before the first if statement:
<div class="ms-srch-hover-imageContainer">
<img id="_#= ctx.CurrentItem.csr_id =#_" src="_#= $urlHtmlEncode(ctx.CurrentItem.Path) =#_" onload="this.style.display='block';" /></div>
Save the file and refresh the search results. A larger image shows in the hover now:
If you do not have a Search Center site collection and only see .js files, here is the modification to the Item_Picture_HoverPanel.js:
,' <div id="', $htmlEncode(id + HP.ids.body) ,'" class="ms-srch-hover-body">'
,''
,' <div class="ms-srch-hover-imageContainer">'
,' <img id="', ctx.CurrentItem.csr_id ,'" src="', $urlHtmlEncode(ctx.CurrentItem.Path) ,'" onload="this.style.display=\'block\';" />'
,' </div>'
,' '
);
if(!Srch.U.n(ctx.CurrentItem.PictureURL)){












