javascript - .bind() .live() not working in Safari or Chrome, but works in Firefox -


I am very new to this, can someone point me in the right direction?

The way I want my website to work mostly in Firefox, but now I'm trying to test it in Safari or Chrome, it does not work. I am sure that there will be many problems later, but the first issue is that I am working with it, my main NAV button is not working. Click handler and mouseleave and mousecenter are not working

function onLoad () {var $ list = $ ('# mainNavList' );

Is there anything wrong with this code or is it a problem somewhere else? ShowMainMenu (); Specify the menu showing the // menu. Crawling Element ('#new Newville'); specifyScrollingElement ('# lowerNav'); $ list.find ('link inactive'). Live ('click', on the menuman menu); $ ('. AlbumLink'). Original (). Bine ('mousecenter', function () {$ (this) .css ({'background-color': '#fff'})}} $ $ ('albumlink'). Binding ('mouseover', function) ( If ($ (this) .hasClass ('current') == incorrect) {$ (this) .css ({'background -color': 'RGBA (233, 22 9, 19, 9)'});} ('. TextLink') parent () .bind ('mousecenter', function () {$ (this) .css ({'background-color': 'rgba (65,65,65, $ ('. TextLink'). Parent () .bind ('mouseleave', function () (if (portfolioactive == incorrect & amp; $ (this). Child () Haclas ('Portfolio Button') == True) {$ (this). CSS ({'Background-color': 'Transparent ('' Background-color ':' if '); (if it is) portfolio (=) true & amp; $ (this). Child () .Hackless (' home button ') = = true) {$ (this) Transparent '});};}); $ List.find (' link active ') live (' click ', function () {var $ this = $ (this); $ this.addClass (' linkInactive ') RemoveClass ('linkactive'); hideThumbs ($ list);}); thumbnailActions ('# mainNavList'); thumbnailActions ('# lowerNav'); initUpperNavActions ();}

Use 'on' instead of 'bind' and 'live' ... this should save you a world of suffering later on. / P>

  as jQuery 1.7, .on () The method is the preferred method. For earlier versions to add event handlers to a document, the .bind () method elements are used to directly attach an event handler, the handler is connected to the currently selected elements in the jQuery object Therefore, those elements must be present at that point which is .bind (). To force more flexible events, see the discussion of event delegation in .on () or .delegate ().   

Anything:

  As jQuery 1.7, .live () method is deprecated. Use the .on () to attach the event handler. The old versions of JQuery should use the user .delegate () for priority in .live ().   

and the example of using 'on' for your code will be:

  $ ('. AlbumLink'). Parent (). on ('mousecenter', function () {$ (this) .css ({'background-color': '#fff'})}};    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -