The website I am customizing is http://flamelogs.com. When I resize my window for mobile view the cart menu expands and cannot collapse and the nav menu does not expand. Everything is fine when the window is at normal view. I really don't have great experience with Javascript/Jquery so I don't know how to troubleshoot this. If someone could please inspect the element and give me some help I would greatly appreciate it. I received the error about where Jquery targets the ul.accordion Uncaught TypeError: undefined is not a function
jQuery(document).ready(function () {
jQuery("ul.accordion li.parent").each(function(){
jQuery(this).append('<em class="open-close"> </em>');
});
jQuery('ul.accordion').accordionNew();
jQuery("ul.accordion li.active").each(function(){
jQuery(this).children().next("ul").css('display', 'block');
});
});
jQuery has predefined library of function. You are used following code in script. Where accordionNew() is not predefined function of Jquery Library so this issues shows in console of your browser. Please use predefine function.
TypeError: jQuery(...).accordionNew is not a function
jQuery('ul.accordion').accordionNew();
Please remove this code.
Related
I have a page created using Zurb Foundation 6. I have a modal set up and working correctly.
I am trying to close the modal when an element is clicked like this..
jQuery('#test').click(function(){
jQuery('#exampleModal').foundation('reveal', 'close');
});
But this is giving me the following error message...
Uncaught ReferenceError: We're sorry, 'reveal' is not an available method for e.
Where am I going wrong?
Looks like you have too many parameters in the foundation() function. Here's the documentation for closing the Reveal modal. Try this:
jQuery('#test').click(function() {
jQuery('#exampleModal').foundation('close');
});
Make sure #test is the ID of the element you're clicking to close, and #exampleModal is the ID of the Reveal modal.
Try
$('#exampleModal').foundation('close');
When my Bootstrap Modal Window is open, I have been unable to stop background scrolling from the main page. I followed the directions given in this StackOverflow question, but I have been unsuccessful so far: Prevent BODY from scrolling when a modal is opened
On the left side, near top of this page, after it loads, you will see a button that says "Large Modal". If you click it, it will open a modal window. After its open, if you scroll up and down, you will see the background moving.
http://gettinmobile.com/home.html
I have added the CSS as directed in the stackoverflow question I linked to above:
body.modal-open {
overflow: hidden;
}
I have added the javascript shown on the same stackoverflow question, though I am not sure this is done correctly:
<script type='text/javascript'>
$("#myModal").on("show", function () {
$("body").addClass("modal-open");
}).on("hidden", function () {
$("body").removeClass("modal-open")
});
</script>
Any help would be appreciated, maybe someone can see what I'm doing wrong... thanks!
You need to wait for jQuery to finish loading before you start binding events. You can do this most simply with an anonymous function:
$(function(){
// YOUR CURRENT JS CODE HERE
});
in your JS code at the bottom of page, try replacing the "$" sign with "jQuery" (no quotes), and see if that helps, it's a common happening in WordPress and quite likely the root of your problem
May I know what the name of this function or is there any references to do the function similar to the image below.
I would like to load this when the website is loaded.
I found some method is do using Modal Box but it seem to be not really proper.
Or this is the only way to do it?
Please guide me from here.
You can use jquery onload function and put the relevant code for popup window.
(https://api.jquery.com/load-event/) or you can use `window.onload=Load().
There are many popup window jquery modals - http://www.jquerybyexample.net/2013/01/jquery-popup-window-tutorial-plugins.html
I personally recommend you to use http://dinbror.dk/bpopup/ , I have tried that and it's cool.
$( window ).load(function() {
$('element_to_pop_up').bPopup();
});
Hope you got the answer :)
JQuery has it's own native Modal Popup window.
$("test").dialog({
modal: true,
height: 140
});
Should get you started.
INFO: http://jqueryui.com/dialog/#modal
I have created a popup using the lightweight jQuery plugin: bPopup.
I want the popup to appear on page load, and as such have the following code:
<script>
;(function($) {
$(window).load(function(){ //see edit below
$('#popup').bPopup({
opacity: 0.6,
modalClose: true
});
});
})(jQuery);
</script>
the customisation modalClose: true controls weather or not the popup is closed/dismissed on clicking on the popup, or surrounding overlay (see API)
However my popup successfully appears but does not dismiss, either when clicking on overlay OR when clicking on the element with the class that controls dismissal (by default, any element with class 'b-close' will also close the popup.
Any thoughts on where I am going wrong, or how I can find out what aspect is not working? Thanks
EDIT:
As per a suggestion in comments I have altered $(window).load(function(){ to $(document).ready(function(){however my problem persists
Discovered I was using 0.7.1 version of the popup, updated to 0.9.1 and that seems to have resolved the issue. Thanks to those who took a look.
I'm making a script to open all links on a page when I click a button in my toolbar. What exactly is wrong with the following code?
function performCommand(event) {
if (event.command == "open-tests") {
$('a').each(function(index, elem) {
window.open($(elem).attr('href'));
});
}
}
As far as getting to the function, it does this fine, as if I comment out the if statement and put in a simple alert, it will work as expected. However the above code does not work.
There is no standard command property of the event object provided by jQuery.
Why do you think there is one?
Did you disable your PopUp Manager or are you using any other kind of adblocker / secure plugin?
Despite that Safari refuses to window.open when called in a callback
more to read:
http://jensarps.de/2009/08/21/safari-and-window-open/