I'm having a problem with the draggable function in jQuery. This however, only happens after the window is shut, or other functions on other windows are used.
Let me define 'window'. My code creates a small rectangular window to display data.
<div class='story'>
<h3>On the Merits of Mass Book-Burning</h3>
<h4 class='close'>(close)</h4>
<ul>
<li>Author: Maxwell S.</li>
<li>Description: Satire</li>
<li>Rating: T</li>
<li>D: ✘ L: ✔ S: ✘ V: ✘</li>
<li>Published: 2014-02-19</li>
<li><button>View</button></li>
</ul>
</div>
The JS for this is:
$("#sidebar").on('click', 'a', function(){
$(this).unbind('click');
$(this).find(".story").fadeOut();
var thistext = $(this).text();
var DRY = ".story:contains('" + thistext + "')";
$(DRY).parents().find(".story").fadeOut();
//pausecomp(100);
$(DRY).fadeIn();
$(DRY).draggable();
$(DRY).find(".close").on('click', function(){
$(this).closest(".story").fadeOut();
$(this).find(".close").unbind('click');
});
$(DRY).find("button").on('click', function(){
$(this).closest(".story").fadeOut();
$("#content").css('background-color','#152a46');
$("#content").css('display','none');
$(this).find("button").unbind('click');
var title = $(this).closest(".story").find("h3").text();
title = title.replace(/ /g,"%20");
var https = "[REDACTED]";
var url = https + title;
$("#content").load(url,function(responseTxt,statusTxt,xhr){
//if(statusTxt=="success")
// alert("External content loaded successfully!");
if(statusTxt=="error")
alert("Error: "+xhr.status+": "+xhr.statusText);
});
$("#content").css('display','block');
});
});
So, you open a 'window', then you can view the contents of the story in the main content area. The problem is that after I do this once or twice on any of these windows, windows refuse to respond - none of the buttons do anything anymore - they report that "Undefined is not a function" in the Chrome devtools - further this error appears to fire at the .draggable(call) above.
I've already looked at this site, and the constant thing I find is order of declaration - and I've already checked it:
<head>
<title>Mellifluous</title>
<link rel="stylesheet" href="styles.css?version=1424206224"/>
<script src="http://ift.tt/1yCEpkO"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script src="application.js?version=1424206224"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
</head>
Thank you!
`
Aucun commentaire:
Enregistrer un commentaire