I am currently trying to use jqDnR on a project ( link )
The only thing is, one part the script that they give you to insert onto the page is:
$().ready(function() {
$('#ex1').jqResize('.jqResize');
});
Normally this wouldn't be a problem, but my divs are coming from a database meaning that I can't define each one in the script as the database rows will be changing all the time.
Is there any way I could use a different method so that I could use this script, for example document.getElementsByName('something');?
I can get it to work in Firefox but not IE with this code:
function init () {
var test = document.getElementsByName('test');
for (var i = 0; i < test.length; i++) {
$().ready(function() {
$('#' + test[i].id).jqResize('.jqResize');
});
}
}
window.onload = function()
{
init()
}
...with this html
<div id="ex1" name="test" class="jqDnR">
I am an example Box "#ex1"<br />
You can *RESIZE* Me.
<div class="jqHandle jqResize"></div>
</div>
and I also have tried this...and again works with firefox but not IE (the error message I get in IE is test[...].id is null or not an object)function getElementsByClass( searchClass, domNode, tagName) {
if (domNode == null) domNode = document;
if (tagName == null) tagName = '*';
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = " "+searchClass+" ";
for(i=0,j=0; i<tags.length; i++) {
var test = " " + tags[i].className + " ";
if (test.indexOf(tcl) != -1)
el[j++] = tags[i];
}
return el;
}
function init () {
var test = getElementsByClass('jqDnR');
for(i=0; i<test.length; i++)
$().ready(function() {
$('#' + test[i].id).jqResize('.jqResize');
});
}
window.onload = function()
{
init()
}
...with this html
<div id="ex1" class="jqDnR">
I am an example Box "#ex1"<br />
You can *RESIZE* Me.
<div class="jqHandle jqResize"></div>
</div>
As I am not a javascript expert, I haven't had much luck but maybe you could help me?(or maybe theres another light javascript resize div script?)
- Adam
Edited by adamfran, 20 May 2007 - 08:16 AM.
