- Posts: 1931
Postings
You can freely browse the forum and post in the community forum.
However, you need a valid license to write posts for support (own a valid commercial software license or have purchased a support membership).
Posts only show once reviewed. This is mainly preventive to keep spam away. Thank you for your understanding!
audio on-click event not working
- admin
-
- Administrator
-
Less
More
IP: 207.229.172.231
13 years 7 months ago #1974
by admin
Olivier.
Replied by admin on topic Re: audio on-click event not working
I am a little confused here. On the site, I do not see any of your code or any jQuery for that matter. Did you enable the jQuery Easy plugin and selected jQuery?
Your code does not show: when using templates and adding javascript files to it, you have to do so manually in the template's index.php file. You can also use the jQuery Easy plugin in the advanced options to include scripts or scripts declarations.
Putting the audio files into /audio does not make them automatically available to any other part of the site. I would suggest you leave all your personal files under the /templates/beez_20. Your scripts in /javascript and audio files in /audio.
Your code does not show: when using templates and adding javascript files to it, you have to do so manually in the template's index.php file. You can also use the jQuery Easy plugin in the advanced options to include scripts or scripts declarations.
Putting the audio files into /audio does not make them automatically available to any other part of the site. I would suggest you leave all your personal files under the /templates/beez_20. Your scripts in /javascript and audio files in /audio.
Olivier.
- mamboze
-
Topic Author
- New Member
-
Less
More
- Posts: 15
IP: 118.172.124.183
13 years 7 months ago #1975
by mamboze
Replied by mamboze on topic Re: audio on-click event not working
Basically, what I want to do is to access the on-click event in Joomla such that I can link the jquery event handler to it. The same applies to the mouseover (hover) event.
I want to avoid, if possible, inline code as I will have a large number of audio files linked in this way and, I think, it would be easier this way from a maintenance viewpoint. I hope to utilize the jquery code I posted before to do all this work.
Thanks
I want to avoid, if possible, inline code as I will have a large number of audio files linked in this way and, I think, it would be easier this way from a maintenance viewpoint. I hope to utilize the jquery code I posted before to do all this work.
Thanks
- admin
-
- Administrator
-
Less
More
- Posts: 1931
IP: 207.229.172.231
13 years 7 months ago #1981
by admin
Olivier.
Replied by admin on topic Re: audio on-click event not working
I understand and I agree.
That said, the code won't work on your site if it is not loaded at all. You have to call the javascript file from inside the template or from the jQuery Easy plugin and have the jQuery library loaded. So far, you are giving me some code and a template and there is nothing that links them together.
That said, the code won't work on your site if it is not loaded at all. You have to call the javascript file from inside the template or from the jQuery Easy plugin and have the jQuery library loaded. So far, you are giving me some code and a template and there is nothing that links them together.
Olivier.
- mamboze
-
Topic Author
- New Member
-
Less
More
- Posts: 15
IP: 118.172.107.140
13 years 7 months ago #2010
by mamboze
Replied by mamboze on topic Re: audio on-click event not working
Hi Olivier,
Sorry for the delay in replying. I had an issue with the site in which the Admin menu simply disappeared. It turned out to be a conflict between JSN PowerAdmin and jQuery Easy which occurred after I enabled jQuery Easy. Uninstalling PowerAdmin solved the problem but it took some time to work out what had happened. Anyhow be that as it may, I've now:
1. put the script with full path in the Beez_20 javascript folder
2. I've modified the script to include a full path specifying audio file location, thus:
3. I tried placing the script in two locations, Advanced Options Frontend and Backend >other>add scripts separately.
But, the script is still not working. Obviously, I'm missing some step here
Sorry for the delay in replying. I had an issue with the site in which the Admin menu simply disappeared. It turned out to be a conflict between JSN PowerAdmin and jQuery Easy which occurred after I enabled jQuery Easy. Uninstalling PowerAdmin solved the problem but it took some time to work out what had happened. Anyhow be that as it may, I've now:
1. put the script with full path in the Beez_20 javascript folder
2. I've modified the script to include a full path specifying audio file location, thus:
Code:
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery("p").hover(
function() {
jQuery(this).css({"color": "red", "font-weight" : ""});
},
function() {
jQuery(this).css({"color": "black", "font-weight" : ""});
}
);
jQuery("p").click(function (event) {
var element = jQuery(this);
var elementID = event.target.id;
var oggVar=("/home/english2/public_html/templates/beez_20/audio/"+elementID +".ogg");
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', oggVar);
audioElement.load();
audioElement.addEventListener("load", function() {
audioElement.play();
}, true);
audioElement.play();
});
});
But, the script is still not working. Obviously, I'm missing some step here
- admin
-
- Administrator
-
Less
More
- Posts: 1931
IP: 207.229.172.231
13 years 7 months ago #2012
by admin
Olivier.
Replied by admin on topic Re: audio on-click event not working
You are one step closer (jQuery is finally showing) but your scripts won't show if you just put them in a specific folder. You have to call the script from the template. Like I explained before, add the <script> tag manually into the template in index.php or just add the script file in the jQuery Easy plugin in the advanced parameters (path to the script file in 'add to script'). Nothing will happen if you don't tell it to.
You should look at tutorials on how to create/modify templates especially if you are new to Joomla!
Although I can help, this is getting pretty much out of scope for me.
You should look at tutorials on how to create/modify templates especially if you are new to Joomla!
Although I can help, this is getting pretty much out of scope for me.
Olivier.
