dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Want clickable image

  1. #1
    Join Date
    Jul 2014
    Posts
    2

    Unhappy Want clickable image

    Hello everyone , I need a little help from you to edit my blog template.
    This is about a .xml blogger template. I have thumbnail images of my posts on the homepage. By default the image is not clickable. I tried to edit the code to make the thumbnail a image-link to my post page. How can I do this?
    I am giving the codes below. Please tell me where to edit
    Codes:

    function createSummaryAndThumb(pID){
    var div = document.getElementById(pID);
    var imgtag = "";
    var img = div.getElementsByTagName("img");
    var summ = summary_noimg;
    if(img.length>=1) {
    imgtag = '<img src="'+img[0].src+'" class="pbtthumbimg"/>';
    summ = summary_img;
    }

    var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
    div.innerHTML = summary;
    }
    ________________________________________________________________________________________
    And-

    <div class='post-body entry-content'>

    <b:if cond='data:blog.pageType != &quot;static_page&quot;'>
    <b:if cond='data:blog.pageType != &quot;item&quot;'>
    <div expr:id='&quot;summary&quot; + dataost.id'><dataost.body/></div>
    <script type='text/javascript'>createSummaryAndThumb(&quot;summary<dataost.id/>&quot;</script>
    </b:if>
    </b:if>
    <b:if cond='data:blog.pageType == &quot;item&quot;'><dataost.body/></b:if>

    <b:if cond='data:blog.pageType == &quot;static_page&quot;'><dataost.body/></b:if>

    <b:if cond='data:blog.pageType != &quot;static_page&quot;'>
    <b:if cond='data:blog.pageType != &quot;item&quot;'>
    <div style='float:right;padding-right:10px;margin-top:10px;'>
    <span class='morenbt'><a expr:href='dataost.url'>Read More</a></span>
    </div>

  2. #2
    Join Date
    Mar 2012
    Posts
    1,811
    I do not understand why you need JS to make an image clickable? The standard way to make an image clickable is with an <a> tag. E.g.

    <a href="target.html"><img src="path/image.jpg" alt=""></a>

    This makes the image "image.jpg" clickable and links to "target.html". Amend the names and paths to suit your requirements.

  3. #3
    Join Date
    Jul 2014
    Posts
    2
    jedaisoul, thanks for ur help. But it doesn't solve my problem.
    Whenever I add an image with a link on my Post pages, the JS generates a thumbnail on the homepage but it doesn't contain the link. I want to add <a expr:href='data:post.url'> so that it will create a thumbnail with the post page URl. But I don't know where to add this.
    Can u help?
    Thanks

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,498
    When posting any kind of code, please wrap that code in the appropriate forum tags.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles