Я получаю неожиданное поведение от некоторого разбора jquery xml.XML Разбор неожиданного поведения LiScroll
Я получаю файл с сервера со следующим кодом
$.ajax({
type: "GET",
url: "//path/test.xml",
dataType: "xml",
success: function(xml) { //do stuff }
Он не выполняет, как и следовало ожидать, если взять данные непосредственно из файла и жесткий код его в мой JS работает как ожидается. Данные в файле в виде
<?xml version="1.0" encoding="utf-8"?><ProductRates xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Total="64" Region="UK"><ProductRate><Description>UAE - Dirham</Description><ProductType>CUR</ProductType><CurrencyCode>AED</CurrencyCode><Rate>5.4427</Rate></ProductRate><ProductRate><Description>Australia - Australia Dollar</Description><ProductType>CUR</ProductType><CurrencyCode>AUD</CurrencyCode><Rate>1.6726</Rate></ProductRate></ProductRates>
Поэтому, как только я получаю XML-файл обрабатывается как так
var $xml = $(xml);
var $list = $('#ticker');
$prodtype = $xml.find("ProductType");
$prodtype.each(function() {
var self = $(this);
if(self.text() == "CUR") {
var
$CurrencyCode = self.next('CurrencyCode')
$Rate = $CurrencyCode.next('Rate')
;
$("#ticker").append("<li><a>" +$CurrencyCode.text()+" = "+ $Rate.text()+ " </a></li>");
}
});
Я использую liScroll js/css от http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html, и он работает, но элементы списка складываются вертикально и не горизонтально через контейнер тикера. Может ли быть, как XML-файл анализируется?
CSS-код, связанный на странице перспективе, надеюсь, полезной ...
element.style {
background-image: url(test.img);
}
Matched CSS Rules
currency_ticker_test.shtmlmedia="all"
#content-header {
background-repeat: no-repeat;
background-position: center top;
}
currency_ticker_test.shtmlmedia="all"
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
user agent stylesheetdiv {
display: block;
}
Inherited from div#shell
currency_ticker_test.shtmlmedia="all"
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
font-size: 100%;
}
Inherited from body
currency_ticker_test.shtmlmedia="all"
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
color: #2f2f2f;
}
currency_ticker_test.shtmlmedia="all"
body {
line-height: 1;
}
currency_ticker_test.shtmlmedia="all"
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
font-size: 100%;
}
Inherited from html
currency_ticker_test.shtml media="all"
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
font-size: 100%;
}
Можете ли вы скопировать выходные данные из браузера? это может быть css, или вещи все сбрасываются в один ли. – Papa