Copy link to clipboard
Copied
I'm trying to set success for a clickbox based on a mouse event using javascript, but can't find anywhere in the API documentation that says that might be possible.
Reading up as much as I can, I'm thinking something like this might work...
document.getElementById(“Click1”).addEventListener(“mouseover”, ..........);
where the ........ is something that sets click 1 to success, and does whatever the success option is for that clickbox.
Any pointers would be appreciated. Thanks!
So you want to use the scrollwheel to navigate slides but only for one particular slide?
If that is the case, you can just wrap this up in an if statement for the slide you want to perform this on.
$(window).on("wheel", function(event){
if (cpInfoCurrentSlide==2) {
if(event.originalEvent.deltaY < 0){
window.cpAPIInterface.next();
}
else {
window.cpAPIInterface.previous();
}
}
});
Copy link to clipboard
Copied
If I think I understand correctly - here is what I do.
Suppose I have a click box on the screen named box1 and an assigned action.
This javascript works to magically click that box for you when run.
var box = $('#box1')[0];
cp.clickHandler(box);
Copy link to clipboard
Copied
Thanks so much for the quick reply.
So, that would "click" the box at runtime?
I'm looking for an eventlistener, so that the user can still initiate the action, ideally with a mousewheel movement... but I'd be happy to figure out the code for just a mouseover even, and then I can play with getting the wheel to work.
Perhaps I've been unclear because I used a clickbox object. Doesn't matter the object - happy to use a button too - whatever works! Am I making sense?
Copy link to clipboard
Copied
If you are looking for a mousewheel action to trigger an effect, try playing with this.
In this example, I would place this code as an onEnter Execute JavaScript success action for the slide.
Then I have a simple star shape on the stage named star
Scrolling up will show the star and scrolling down with the mouse wheel will hide the star.
Simply replace the cp.show("star"); and cp.hide("star"); commands with what you want to do.
Hope this helps.
$(window).on("wheel", function(event){
if(event.originalEvent.deltaY < 0){
cp.show("star");
}
else {
cp.hide("star");
}
});
Copy link to clipboard
Copied
Thanks so much! I put in these actions instead...
$(window).on("wheel", function(event){ if(event.originalEvent.deltaY < 0){ window.cpAPIInterface.next(); } else { window.cpAPIInterface.previous(); } });
Which works great... except if I keep using my wheel up, I just scroll through the whole project (past all the timed buttons etc...). Is there any way to make this apply to the current slide only... or better still just when I rollover a particular smartshape/object?
Really appreciate your help! Feel free to tell me to go away! Thanks.
Copy link to clipboard
Copied
So you want to use the scrollwheel to navigate slides but only for one particular slide?
If that is the case, you can just wrap this up in an if statement for the slide you want to perform this on.
$(window).on("wheel", function(event){
if (cpInfoCurrentSlide==2) {
if(event.originalEvent.deltaY < 0){
window.cpAPIInterface.next();
}
else {
window.cpAPIInterface.previous();
}
}
});
Copy link to clipboard
Copied
Thanks this worked perfectly. Really appreciate your help!