Hello,
You have mistake in you script tag :
https://www.w3schools.com/tags/tag_script.asp
<script type=...>
</script>
And not
<script>
type="text/javascript" src="default/show.html"
...</script>
I am not sure why you specify a source as you seem (or should) to include
the this little piece of js into the same view file for which show us some
code above.
So try to fix you script tag then use browser devtools to make sure there
is no js error or warning in your code return by the browser, or you will
just code will just work to.
Another thing about javascript that you should learn is that it is not
executing sequentially... It asynchronous, which mean you don't know
exactly when your code gonna be execute.
So to make it clear in you case. The issue may be related to the fact that
the DOM of the page is not fully render by the browser when you js code is
execute... To make sure the whole DOM is ready you need to surround you
fadeIn() instruction inside this snippet :
<script>
$(document).ready(function() {
alert('It works');
// This is a commented line the above will throw a popup
dysplaying "It works"
// You can paste your fadeIn() below once you make the alert()
working as it make you confident that all the rest work properly
// You can concieve the alert as a python print instruction and
you can use it to "debug" by display variable content at some point in you
js script to make sure it does what you want it do
});
</script>
Good luck and consider commit to a newbie javascript or jQeury tutorial
Richard
On Mon, Apr 3, 2017 at 3:41 PM, Nicholas Nicolaou <
[email protected]> wrote:
> I currently have a page in Web2Py that displays an image. I want this
> image to fade in when the page has loaded, but I am not how to implement
> this JQuery to my web2py page in order to do so.
>
> Here is the view page (show.html) that contains the image (Product_Image):
>
>
> {{extend 'layout.html'}}
> <div class="hiHolder">
>
> <div class="leftShow">
> <img style="width: 100%; max-width: 440px; max-height: 480px;"
> src="{{=URL('default', 'download', args=post.Product_Image)}}"></img></div>
>
>
> Here is the web2py_ajax.html page that contains the JQuery:
>
>
> <script>
> type="text/javascript" src="default/show.html"
>
> $(".leftShow").fadeIn(500);</script>
>
>
> I am currently referencing it by identifying the source page, but I am not
> sure if that is needed. Also I am using the div class inside the JQuery
> function to hopefully reference the image.
>
>
> I am new to web2py so my method may be wrong, any advice will be helpful.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.