How does one ask jQuery to cease script evaluation of AJAX responses?
Most folks look to get script evaluation working. I don't.
I'm trying to place a video as a background (HTML 5, not Flash) and because I have no control over what's included on the requested pages (Tumblr - you can have unique code for Index pages and Permalink pages only, you can't have a home page, old posts pages, and then permalink pages, etc. sadly).
{block:IndexPage}
var productElement = document.getElementById("dreamscene");
if (productElement == null)
{
$("body").append('<img src="http://static.tumblr.com/opbsaiu/mqllkvs1c/overlayyyy.png"
style="position: fixed; z-index: -1; top: 0pt; left: 0pt;
width: 100%; height: 100%;"><video id="dreamscene"
style="position: fixed; opacity:0.343; z-index: -2; top: 0pt;
left: 0pt; width: 100%; height: 100%;"
loop autoplay audio="muted">
<source type="video/mp4" src="videosource#%#$%^&*/dsgfhjk.mp4">
</source></video>');
}
{/block:IndexPage}
I've been trying to get it to check for the element before placing another one. I've concluded the code is running in a separate instance, like a page in a page. Obviously this is very bad, I've actually made IE 9 add an echo effect to the audio.
In Firebug and the IE dev. tools, there is never more than one instance of the video element, so the above code is a开发者_JAVA技巧ttached the document.ready
event and I'm using http://www.infinite-scroll.com/ to make the magic happen.
There is a dataType param.:
$('#thumbnails').infinitescroll({
navSelector : ".next a:last",
nextSelector : ".next a:last",
itemSelector : "#thumbnails .thumb",
bufferPx : 7777,
dataType : 'html',
loadingText: "<span class=\"spectrum\">hold it, cowboy!</span>" },
function(newElements){ itemHovers(); }
);
...but it doesn't seem to have any affect whether it's set to text or html (I've read the docs ;-]).
have you tried instead of
var productElement = document.getElementById("dreamscene");
if (productElement == null)
{
this:
if (!$("#dreamscene"))
{
Also, try adding an Id to the <img>
and looking that id up, instead of the <video>
id. Since <video>
is html5 only it may be giving problems.
精彩评论