Wednesday, November 12, 2014

Dynamically Sliding Picture Library Images using SPService in CEWP (Content Editor Web part)

<div class="ama-outerwrapper"><table width="100%"><tbody><tr><td width="30%" class="ama-newsbox1"><img width="250" height="135" src="/sites/BGL/Banners_homepage/_t/BGLStaticBanner_JPG.jpg" alt=""/></td>
<td class="ama-newsbox2" valign="top"></td>
<td width="70%" class="ama-newsbox3" valign="top"><div class="ama-topnewsimage" id="imgRotator">&#160;</div></td></tr></tbody></table></div>
<script src="/sites/BGL/SiteAssets/jquery-2.1.1.js" type="text/javascript"></script><script src="/sites/BGL/SiteAssets/jquery.SPServices-2014.01.js" type="text/javascript"></script><script language="javascript" type="text/javascript">


var curImgIndex=0
function rotateimages(){
var bannerImg = new Array();
var bannerLink = new Array();
$().SPServices({
operation: "GetListItems",
async: false,
listName: "BGLBanners",
CAMLRowLimit: 10,
completefunc: function (xData, Status) {
var i=0;
$(xData.responseXML).SPFilterNode("z:row").each(function() {    
var pictureURL= '/' + $(this).attr("ows_RequiredField");
var bannerLinkURL = $(this).attr("ows_BannerLinkURL");
var n = bannerLinkURL.indexOf(',');
bannerLinkURL  = bannerLinkURL.substring(0, n != -1 ? n : s.length);
bannerImg[i]=pictureURL;
bannerLink[i]=bannerLinkURL;
i++;        
});  
}
});
var totalBan = bannerImg.length;

 
  if (newBanner == totalBan)
    {
    newBanner = 0;
    }
document.getElementById('imgRotator').innerHTML="<a target=_blank href="+bannerLink[newBanner]+"><img height=135 width=650 src="+bannerImg[newBanner]+"></a>";
newBanner++;
setTimeout("rotateimages()", 3*1000);
}

window.onload=function(){
rotateimages();
}</script>

No comments:

Power Automate + Excel data

Extract excel data, get manager and update row with user details which will get from GET MANAGER Concepts and examples Key column:  Column i...