Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot embed a tag in JavaScript slide
    primarykey
    data
    text
    <p>Created slide gallery via custom jQuery code.</p> <p>HTML:</p> <pre><code>&lt;div id="backgrounds"&gt; &lt;img src="img/site/myimg.jpg" alt="Sample" data-title2="My Subject" data-desc="My Desc" /&gt; &lt;img src="img/site/myimg2.jpg" alt="Sample" data-title2="My Subject" data-desc="My Desc" /&gt; &lt;img src="img/site/myim3.jpg" alt="Sample" data-title2="My Subject" data-desc="My Desc" /&gt; &lt;/div&gt; </code></pre> <p>JS function:</p> <pre><code>function ChangeBackground(background, direction) { if (is_animating) return; is_animating = true; $background = $(background); $newItem = null; if (direction == -1) { $newItem = $background.prev(); if ($newItem.length == 0) { $newItem = $("#backgrounds img").last(); } } else { $newItem = $background.next(); if ($newItem.length == 0) { $newItem = $("#backgrounds img").first(); } } $background.fadeOut(300); $newItem.fadeIn(300, function () { $("#backgrounds img").removeClass("current"); $newItem.addClass("current"); is_animating = false; }); $clone = $("div.item.current").clone(); $clone.removeClass("current").addClass("new"); $clone.find("h1").html($newItem.attr("alt")); $clone.find("h2").html($newItem.attr("data-title2")); $clone.find("p").html($newItem.attr("data-desc")); $clone.css({ display: "none" }); $("div.item.current").after($clone); $("div.item.current").fadeOut(300, function () { $(this).remove(); }); $clone.fadeIn(300, function () { $(this).removeClass("new").addClass("current"); }); } </code></pre> <p>It's working perfect. data-desc is like slide caption. And I want, embed a tag in this caption.</p> <p>So:</p> <pre><code>&lt;img src="img/site/myim3.jpg" alt="Sample" data-title2="My Subject" data-desc="My Desc &lt;a href="#"&gt;My a tag&lt;/a&gt; /&gt; </code></pre> <p>But doesn't work. When check codes by DevTools, I seen:</p> <pre><code>&lt;img src="img/site/myimg3.jpg" alt="Sample" data-title2="My Subject" data-desc="My desc &amp;lt;a href=" #"="" style="width: 1451px; height: 956.0029282576867px; margin-left: -725.5px; left: 50%;"&gt; </code></pre> <p>How can I fix it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload