简体   繁体   中英

Works in jsfiddle but it wont work in dreamweaver

I have read that I have to put back in the event handler for it to work in dreamweaver from JS Fiddle, I have put it back in and I it still wont work? Here is the Demo: http://jsfiddle.net/EfLJJ/6/

Here is my JS Code:

$(document).ready(function() {
$(".list .fs1").bind({
    mouseenter:function(){
        $(".sublist").show();
    },
    mouseleave: function(){
        $(".sublist").hide();
    }
    });
});  

Add the jQuery library to your script.

Put this code inside the <head> tags of your page:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

In your html code inside head put this line of code in order to include the jQuery library:

<script src="//code.jquery.com/jquery-1.10.2.js"></script>

Otherwise will not be able to use it.

In jsfiddle this works in a different way.

Also, if you're using jQuery version 1.7 and above, I'd recommend you switch from using ".bind()" to ".on()" for as ".on()" is the preferred method according to the jquery website. Check out the difference between ".bind()", ".on()" and ".live()" for more info here, What's the difference between `on` and `live` or `bind`?

Problem solved! To get it running in Dreamweaver you have to use the Javascript Script Tags

Javascript:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
        /* Your Code Here */
    </script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM