javascript - "Cannot read property ... of undefined" in jQuery 1.11.0 -- how can I satisfy jQuery's requirement? -
i (trying to) load jquery 1.9.1 un-minified cdn: "uncaught typeerror: cannot call method 'call' of undefined jquery-1.9.1.js:648". updated reference, , apparently getting equivalent error, minified:
uncaught typeerror: cannot call method 'call' of undefined jquery-1.11.0.min.js:2 n.extend.each jquery-1.11.0.min.js:2 (anonymous function) site.js:26 j jquery-1.11.0.min.js:2 k.firewith jquery-1.11.0.min.js:2 n.extend.ready jquery-1.11.0.min.js:2 k jquery-1.11.0.min.js:2
the page @ http://ccachicago.pragmatometer.com; first script tag is:
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
(the page posh plus css styling , light touch of javascript dust; it's simple modern webapp standards...)
--edit--
regarding code, page has, script contents:
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script src="/media/js/site.js"></script> <script> function slideshow() { var width = (jquery(window).width() - 70) * .8; var factor = width / 1024; var height = 420 * factor; jquery('#slideshow').attr('height', height + 'px'); jquery('#slideshow').attr('width', width + 'px'); }; slideshow(); jquery(window).resize(slideshow); </script>
the site.js file has:
/** * override jquery.fn.init guard against xss attacks. * * see http://bugs.jquery.com/ticket/9521 */ (function () { var jquery_init = jquery.fn.init; jquery.fn.init = function (selector, context, rootjquery) { // if string contains "#" before "= 0) { var bracket_position = selector.indexof(' hash_position) { throw 'syntax error, unrecognized expression: ' + selector; } } } return jquery_init.call(this, selector, context, rootjquery); }; jquery.fn.init.prototype = jquery_init.prototype; })(); jquery(function() { jquery.each(jquery('h1').add('h2').add('h3').add('h4').add('h5').add('h6').add('ul#navigation')).function(index, element) { var bounds = jquery(element).offset(); var image_left = bounds.left; var image_top = bounds.top + bounds.height; var image = jquery(''); image.style.position = 'absolute'; image.style.top = image_top + 'px'; image.style.left = image_left + 'px'; } function set_search_width() { var offset = 950; var width = jquery(window).width() - offset; jquery('#menu-search').css('max-width', width + 'px'); jquery('#menu-search').css('width', width + 'px'); jquery('#query').width(width - 80); } jquery(window).resize(set_search_width); set_search_width(); }); sfhover = function() { var sfels = document.getelementbyid('nav').getelementsbytagname('li'); for(var index = 0; index/** * override jquery.fn.init guard against xss attacks. * * see http://bugs.jquery.com/ticket/9521 */ (function () { var jquery_init = jquery.fn.init; jquery.fn.init = function (selector, context, rootjquery) { // if string contains "#" before "<", treat invalid html. if (selector && typeof selector === 'string') { var hash_position = selector.indexof('#'); if (hash_position >= 0) { var bracket_position = selector.indexof('<'); if (bracket_position > hash_position) { throw 'syntax error, unrecognized expression: ' + selector; } } } return jquery_init.call(this, selector, context, rootjquery); }; jquery.fn.init.prototype = jquery_init.prototype; })(); jquery(function() { jquery.each(jquery('h1').add('h2').add('h3').add('h4').add('h5').add('h6').add('ul#navigation')).function(index, element) { var bounds = jquery(element).offset(); var image_left = bounds.left; var image_top = bounds.top + bounds.height; var image = jquery('<img src="/media/images/foldback.png">'); image.style.position = 'absolute'; image.style.top = image_top + 'px'; image.style.left = image_left + 'px'; } function set_search_width() { var offset = 950; var width = jquery(window).width() - offset; jquery('#menu-search').css('max-width', width + 'px'); jquery('#menu-search').css('width', width + 'px'); jquery('#query').width(width - 80); } jquery(window).resize(set_search_width); set_search_width(); }); sfhover = function() { var sfels = document.getelementbyid('nav').getelementsbytagname('li'); for(var index = 0; index < sfels.length; index++) { sfels[i].onmouseover = function() { this.classname += " sfhover"; } sfels[i].onmouseout = function() { this.classname = this.classname.replace(new regexp( " sfhover\\b"), ""); } } } if (window.attachevent) { window.attachevent("onload", sfhover); }
you have incorrect syntxis
what whant ?
jquery(function() { jquery.each(jquery('h1').add('h2').add('h3').add('h4').add('h5').add('h6').add('ul#navigation')).function(index, element) { var bounds = jquery(element).offset(); var image_left = bounds.left; var image_top = bounds.top + bounds.height; var image = jquery('<img src="/media/images/foldback.png">'); image.style.position = 'absolute'; image.style.top = image_top + 'px'; image.style.left = image_left + 'px'; } function set_search_width() { var offset = 950; var width = jquery(window).width() - offset; jquery('#menu-search').css('max-width', width + 'px'); jquery('#menu-search').css('width', width + 'px'); jquery('#query').width(width - 80); } jquery(window).resize(set_search_width); set_search_width(); });
maybe code below want ? ( find elements, think better use complex selector, , apply function each element )
jquery('h1').add('h2').add('h3').add('h4').add('h5').add('h6').add('ul#navigation').each(function(index, element) { var bounds = jquery(element).offset(); var image_left = bounds.left; var image_top = bounds.top + bounds.height; var image = jquery('<img src="/media/images/foldback.png">'); image.style.position = 'absolute'; image.style.top = image_top + 'px'; image.style.left = image_left + 'px'; });
Comments
Post a Comment