javascript - JQuery isn't working but works on JSFiddle -
i've tried , i've been @ few days, jquery isn't working code in dreamweaver. contacted them , it's coding issue. when copy code jsfiddle works, doesn't work html. here jsfiddle link: https://jsfiddle.net/mufeeza/36cmxwxc/
here how link in html:
<script src="jquery-latest.js"></script> <script type="text/javascript" src="/resources/js/home.js"></script>
here js file:
$('#contact').on('mouseenter', function () { "use strict"; $('body').css('background-image', 'url("https://image.ibb.co/fmoqzv/contact.png")'); $('.intro').css('opacity', '0'); }); $('#contact').on('mouseleave', function () { "use strict"; $('body').css('background-image', 'url(http://www.solidbackgrounds.com/images/2560x1440/2560x1440-white-solid-color-background.jpg)'); $('.intro').css('opacity', '1'); }); $('#design').on('mouseenter', function () { "use strict"; $('body').css('background-image', 'url("https://image.ibb.co/d2dqzv/portfolio.png")'); $('.intro').css('opacity', '0'); }); $('#design').on('mouseleave', function () { "use strict"; $('body').css('background-image', 'url(http://www.solidbackgrounds.com/images/2560x1440/2560x1440-white-solid-color-background.jpg)'); $('.intro').css('opacity', '1'); }); $('#develop').on('mouseenter', function () { "use strict"; $('body').css('background-image', 'url("https://image.ibb.co/msqpuv/develop.png")'); $('.intro').css('opacity', '0'); }); $('#develop').on('mouseleave', function () { "use strict"; $('body').css('background-image', 'url(http://www.solidbackgrounds.com/images/2560x1440/2560x1440-white-solid-color-background.jpg)'); $('.intro').css('opacity', '1'); });
jsfiddle wraps javascript code in window onload event handler default (window.onload=function(){...
). can that, wrap in $(document).ready(function() {
call, or move load @ end of document, before closing body element (</body>
).
Comments
Post a Comment