简体   繁体   中英

Why is this jquery transfer not woking

I'm a little confused why this effect transfer is not working in jquery.

my jquery files

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

My HTML.

<img id="sample" class='trial' src='{{ url('taskAssets/'.$stimuli['sample'][0]) }}.jpg'/>
<a id="hello" href='response/{{ $stimuli['comparison'][5]}}'><img class='trial'  src='{{ url('taskAssets/'.$stimuli['comparison'][5]) }}.jpg' /></a></td>

My CSS for the transfer:

.ui-effects-transfer {
border: 5px solid black;
  }

And my jquery script

<script>


$("#sample").effect("transfer", {to: $("#hello")}, 1000);

</script>

Any ideas?

You're running the code before the DOM is finished loading. Try this:

$(document).ready(function () {
    $("#sample").effect("transfer", { to: $("#hello") }, 1000);
});

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