Reputation: 3640
This is a simple version of what I am looking for: http://jsfiddle.net/mitchbregs/DLg92/5/
Now for a more complex version as here: http://jsfiddle.net/mitchbregs/E7a9S/1/
The simple version works just fine. It has no issues and the event is completely corrent.
Now when you look at the more complex website, my event doesn't happen and I don't see why there is an issue.
I added the correct script to both websites and only the simple one is working.
I am trying to make it so that when a user click 'n' the text_input_box opens just like it would if you click the 'Add Note' button in the navigation menu.
I'm pretty new to jQuery and JavaScript so this is just a learning project I'm working on.
Thank you all for your time and help!
Upvotes: 3
Views: 60
Reputation: 21884
It won't fix your problem, but here's a few things to improve your js:
$(".postIt-" + id).css("width",wh);
$(".postIt-" + id).css("height",wh);
$(".postIt-" + id).css("transform","rotate("+rotatedegree+"deg)");
// ...
Don't repeat $(".postIt-" + id)
, it's slower and useless:
$(".postIt-" + id).css("width",wh)
.css("height",wh)
.css("transform","rotate("+rotatedegree+"deg)")
// ...
Instead of this:
if (randomBg == 1){
$(".postIt-" + id).addClass("bg_one");
}
if (randomBg == 2){
$(".postIt-" + id).addClass("bg_two");
}
Do this:
var setRandomBg = function(postit_id, bg_id) {
$(".postIt-" + postit_id).addClass("bg_" + bg_id); // you would need to rename your classes with numbers
}
// and call it
setRandomBg(id, randomBg);
Upvotes: 1
Reputation: 4983
Alright i found the problam actually its not in your code, and this is the fiddle: http://jsfiddle.net/E7a9S/5/
The problam was that you included mootools in jsfiddle that made jquery not work properly.
the simple version worked just fine because if you notice there you actually did included the jquery and not the mootools.
btw the advanced one is just beautiful and is really cool.
Good Luck!
Upvotes: 3