javascript - Jquery drop down not firing on server, works on desktop -


i handed script update web page client (another team member wrote jquery)and handed me of test files. running locally, jquery drop down (very simple) worked fine.

i ported on code expressionengine, yet doesn't anything. know jquery functioning fine because slider , other elements powered work appropriately. drop down doesn't anything.

curious, inserted jquery function located in function.js command line , worked..

so, , correct me if i'm wrong here, appears not running function on load? ideas here?

$(window).load(function() {     $('.slider').flexslider({         animation: "slide",         slideshowspeed: 6000,         animationspeed: 800,         pauseonaction: false     });      $('.testimonials .flexslider').flexslider({         animation: "slide",         slideshowspeed: 600000,         animationspeed: 800,         pauseonaction: false,         directionnav: false     });      $('.nav li').hover(function() {         $('.sub-menu', this).stop(true, true).slidedown();     }, function() {         $('.sub-menu', this).slideup();     }); }); 

^ barebones simple. code changed html (for menu), css (for styling sub elements) , function.js file.

here 'old' version:

$(window).load(function() { $('.slider').flexslider({     animation: "slide",     slideshowspeed: 6000,     animationspeed: 800,     pauseonaction: false });  $('.testimonials .flexslider').flexslider({     animation: "slide",     slideshowspeed: 600000,     animationspeed: 800,     pauseonaction: false,     directionnav: false }); 

});

such miniscule issue, holding me up. thoughts?

this wont make difference, try change $(window).load(function() { $(document).ready(funciton() { or $(function() {

futher reading: window.onload vs $(document).ready()

window.onload built-in javascript event, implementation had subtle quirks across browsers (ff/ie6/ie8/opera)

also, make sure surround jquery selectors in if ($(selector).length) check, if not present on page, cause error , scripts stop processing:

$(function() {     if ($('.slider').length) {         $('.slider').flexslider({             animation: "slide",             slideshowspeed: 6000,             animationspeed: 800,             pauseonaction: false         });     };      if ($('.testimonials .flexslider').length) {         $('.testimonials .flexslider').flexslider({             animation: "slide",             slideshowspeed: 600000,             animationspeed: 800,             pauseonaction: false,             directionnav: false         });     };      if ($('.nav li').length) {         $('.nav li').hover(function() {             $('.sub-menu', this).stop(true, true).slidedown();         }, function() {             $('.sub-menu', this).slideup();         });     });  }); 

http://jsfiddle.net/p5jpp/1/


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -