<link href="/sites/mysitename/SiteAssets/JS/lightslider.css">
<script src="/sites/mysitename/SiteAssets/JS/jquery-1.11.0.js"></script>
<script src="/sites/mysitename/SiteAssets/JS/lightslider.js"></script>
<script language="javascript" type="text/javascript">
function isTrustedIE(){
try{
var test=new ActiveXObject("Scripting.FileSystemObject");
return true;
}
catch(e){
return false;
}
}
$(document).ready(function(){
我使用的是第三方转盘(lightslider js)的问题 当我打开IE 8时,图像没有加载,当我按下时 ctrl + f5 ... 2 3次它增加了一个脚本错误来了“成员找不到jquery 1.11.0”我googled并遇到 preventDefault()但我仍然可以解决问题
谢谢你
$("#content-slider").lightSlider({
item: 1,
loop: true,
auto:true,
slideMargin: 5,
mode: "slide",
useCSS: true,
cssEasing: 'ease',
easing: 'linear',
thumbItem: 0,
gallery: false,
speed: 200, //ms'
auto: true,
loop: true,
slideEndAnimation: true,
});
var siteUrl = window.location.protocol +"//"+ window.location.hostname +"/sites/mysitename/_vti_bin/lists.asmx";
//Soap for Images
var soapimages = "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
<soap:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>images</listName> \
<query><Query> \
</Query></query>\
<viewFields> \
<ViewFields> \
<FieldRef Name='Name'/> \
<FieldRef Name='FileRef'/> \
</ViewFields> \
</viewFields> \
<rowLimit>5</rowLimit> \
<queryOptions xmlns:SOAPSDK9='http://schemas.microsoft.com/sharepoint/soap/'><QueryOptions/> \
</queryOptions> \
</GetListItems> \
</soap:Body> \
</soap:Envelope>";
//Soap call for Header Text
jQuery.ajax({
url: siteUrl ,
type: "POST",
dataType: "xml",
data: soapimages ,
complete: function(xData, status){
jQuery(xData.responseXML).find("z\\:row").each(function () {
var bannerURL = $(this).attr("ows_FileRef").split(";#")[1];
var newli = '<li><img class="imgCarousal" src="/'+bannerURL+'"/></li>';
$('#content-slider').append(newli);
$('img.imgCarousal').each(function()
{
var maxWidth =990; // Max width for the image
var maxHeight =230;// Max height for the image
var ratio = 0; // Used for aspect ratio
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
// Check if the current width is larger than the max
if(width > maxWidth)
{
ratio = maxWidth / width; // get ratio for scaling image
$(this).css("width", maxWidth); // Set new width
$(this).css("height", height * ratio); // Scale height based on ratio
height = height * ratio; // Reset height to match scaled image
width = width * ratio; // Reset width to match scaled image
}
// Check if current height is larger than max
if(height > maxHeight)
{
ratio = maxHeight / height; // get ratio for scaling image
$(this).css("height", maxHeight); // Set new height
$(this).css("width", width * ratio); // Scale width based on ratio
width = width * ratio; // Reset width to match scaled image
}
});
});
},
contentType: "text/xml; charset=\"utf-8\""
});
});
</script>
<style>
img.imgCarousal
{
width:990px !important;
}
#container-carousal
{
width:1000px;
padding:0px!important;
height:300px;
}
ul {
list-style: none outside none;
padding-left: 0;
margin-bottom:0;
}
</style>
<div id="container-carousal">
<ul id="content-slider" class="content-slider">
</ul>
</div>