CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   activate spin.js jquery plugin from javascript (http://www.codingforums.com/showthread.php?t=281456)

JeremyJohn 11-07-2012 08:56 PM

activate spin.js jquery plugin from javascript
 
Hi guys, how do i activate this:

Code:

$(window).load(function spinner(){
var opts = {
  lines: 10, // The number of lines to draw
  length: 7, // The length of each line
  width: 4, // The line thickness
  radius: 6, // The radius of the inner circle
  corners: 1, // Corner roundness (0..1)
  rotate: 0, // The rotation offset
  color: '#000', // #rgb or #rrggbb
  speed: 1.2, // Rounds per second
  trail: 50, // Afterglow percentage
  shadow: false, // Whether to render a shadow
  hwaccel: false, // Whether to use hardware acceleration
  className: 'spinner', // The CSS class to assign to the spinner
  zIndex: 2e9, // The z-index (defaults to 2000000000)
  top: 'auto', // Top position relative to parent in px
  left: 'auto' // Left position relative to parent in px
};
var spinner = new Spinner(opts).spin();
$("#sendstatus").append(spinner.el);
});

from this javascript code:

Code:

function CheckFileType( fileName, fileTypes ) {
if (!fileName) return;

dots = fileName.split(".");
fileType = "." + dots[dots.length-1];

if (fileTypes.join(".").indexOf(fileType) != -1) {
    //>>>>>>>>>>>>> ACTIVATE spin.js JQUERY PLUGIN HERE <<<<<<<<<<<<<<<<<<<<<<
  return true;
} else {
  alert('Please select a ScreenShot file (.tga) only!');
  return false;
}
}

I have tried using this method which i found from answers in other questions:

Code:

if (fileTypes.join(".").indexOf(fileType) != -1) {
    function startSpin() {
    var target = document.getElementById('demarrer');
    var spinner = new Spinner().spin(target);
    }
  return true;
} else {
  alert('Please select a ScreenShot file (.tga) only!');
  return false;
}
}

and this method

Code:

if (fileTypes.join(".").indexOf(fileType) != -1) {
  var spinner = new Spinner(opts).spin();
  return true;
} else {
  alert('Please select a ScreenShot file (.tga) only!');
  return false;
}
}

but it won't work...

The HTML codes:

Code:

<div id="sendstatus"></div>
<input name="ScreenShotFile" id="ScreenShotFile" type="file"/>
<input type="submit" id="uploadScreenShot" value="Upload" name="uploadScreenShot" onClick="return CheckFileType(document.getElementById('ScreenShotFile').value, ['.tga']);" />

Thanks


All times are GMT +1. The time now is 10:34 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.