Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a ticker news with vertical sliding. I need to slide both images and text along with it, which is coming from a single list.

How to give the image source in this jquery code? The image is a column name from an announcement list. The code below is the jquery I have used for vertical scrolling ticker with only text.

<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script><script type="text/javascript">
$(document).ready(function() {   
var soapEnv ="<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>Ticker</listName> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='Title'/>\
                               <FieldRef Name='Body'/> \ 
                               <FieldRef Name='Link'/> \
                               <FieldRef Name='Image'/> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>"; 

        $.ajax({
            url: "/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: Result,
            contentType: "text/xml; charset=\"utf-8\""
        });
    }); 
tickmectr = 1;
function tick(){
if (tickmectr)
    $('#news li:first').slideUp( function () {
$(this).appendTo($('#news')).slideDown(); });
}


    function Result(xData, status) {
$("#news").html('');
$(xData.responseXML).find("z\\:row").each(


function() 
{
    var imageURL = ($(this).attr("ows_Image")).split(",")[0];
    var bodyURL = ($(this).attr("ows_Body")).split(",")[0];

    var linkticker = ($(this).attr("ows_Link"));
    var liHtml = "<li> <font color=blue > <b>" + $(this).attr("ows_Title") + "<br>" + $(this).attr("ows_Body") +  "</font></b> </li>";

    if ( linkticker )
    var liHtml = "<li> <font color=blue > <b>" + $(this).attr("ows_Title") + "</b></font> <div><tr align='top'>" + 
                            "<td><img src='" + imageURL + "'><br></td> <a href='" + linkticker  + "'>" + bodyURL +  "</a>" +
                           "</tr></div></li>";


        $("#news").append(liHtml);
    });

setInterval(function(){ tick () }, 5000);
} 
function tickme(tick)
{
    tickmectr=tick
}
 </script><style>
 UL#news {
POSITION: relative; MARGIN: 0px auto; WIDTH: 110px; BACKGROUND: #fff; HEIGHT: 170px
 }
 UL#news LI {
POSITION: relative; MARGIN: 0px; WIDTH: 150px; DISPLAY: block; HEIGHT: 170px
}</style><ul id="news" onmouseover="tickme(0)" onmouseout="tickme(1)"></ul>
share|improve this question

1 Answer 1

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




$(document).ready(function() {   
var soapEnv ="<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>New Hire</listName> \
                    <viewFields> \
                        <ViewFields> \
                           <FieldRef Name='Title'/>\
                           <FieldRef Name='Body'/> \
                           <FieldRef Name='Link'/> \
                           <FieldRef Name='Image'/> \
                       </ViewFields> \
                    </viewFields> \
                </GetListItems> \
            </soapenv:Body> \
        </soapenv:Envelope>"; 

    $.ajax({
        url: "/_vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: Result,
        contentType: "text/xml; charset=\"utf-8\""
    });
}); 
tickmectr = 1;
function tick(){
    if (tickmectr)
$('#news li:first').slideUp( function () { $(this).appendTo($('#news')).slideDown(); });
}


function Result(xData, status) {
    $("#news").html('');
    $(xData.responseXML).find("z\\:row").each(

function() 
{
 var imageURL = ($(this).attr("ows_Image")).split(",")[0];
 var bodyURL = ($(this).attr("ows_Body")).split(",")[0];

    var linkticker = ($(this).attr("ows_Link"));
    var liHtml = "<li> <font color=blue > <b>" + $(this).attr("ows_Title") + "<br>" + $(this).attr("ows_Body") +  "</font></b> </li>";

    if ( linkticker )
    var liHtml = "<li> <font color=blue > <b>" + $(this).attr("ows_Title") + "</b></font> <div><tr align='top'>" + 
                            "<td><img src='" + imageURL + "'><br></td> <a href='" + linkticker  + "'>" + bodyURL +  "</a>" +
                           "</tr></div></li>";


        $("#news").append(liHtml);
    });

    setInterval(function(){ tick () }, 5000);
} 
 function tickme(tick)
 {
     tickmectr=tick
 }
     </script>
    <style>
 UL#news {
POSITION: relative; MARGIN: 0px auto; WIDTH: 110px; BACKGROUND: #fff; HEIGHT: 170px
  }
  UL#news LI {
POSITION: relative; MARGIN: 0px; WIDTH: 150px; DISPLAY: block; HEIGHT: 170px
 }
 </style>
  <ul id="news" onmouseover="tickme(0)" onmouseout="tickme(1)"></ul>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.