It seems like this should be a pretty obvious answer but I'm under pressure for portfolio and I think I may be confusing myself here. I couldn't quite find the answer that I was looking for (which I usually am able to on this site).
Basically I want to load an external page with an image into my gallery. The only catch is that the gallery itself is loaded from an external page.
I was able to successfully implement this when I put the gallery code into its own individually loading window. But when I try it with the original setup, of course, I have to delegate. I know how to set that up, it's just defining the function itself that's giving me problems (where "window" calls the div that contains the gallery on its external page):
function showPiece(show) {
window.load(show);
}
How do I "delegate" here?
Also, I wanted to make sure I figured out how to click back to the gallery as well. That wasn't working for me either for some reason. Here's what I was using (you can see on the guitar page on the portfolio2.html page):
window.on('click',"#back", function(e){
e.preventDefault();
showPage('portfolio.html');
manageNavState($(this));
});
Here's my site so you can see in detail what's going on:
Portfolio Site
And here's the other gallery page I made:
Second Gallery Page
Sorry if this is a dumb question. Thanks in advance everyone!
===EDIT===
Nevermind, my code was perfectly fine. I found out I just had to open and close with html tags in the linked image pages, which I didn't expect because I didn't have to do it elsewhere. One image is still not working, but I'll figure it out.
Related
I've been trying, for a few days, to add an animation between two different HTML pages/files (index.html -> about.html). My idea is to animate/have a transition when going from one page to the other: in my case from the index.html to the about.html page.
I found a lot of answers on Google and on StackOverflow, but the problem is that the transition happens on the same page which means that the HTML code for both pages is in the same file and my index.html becomes unreadable, especially if I am working on a project that's quite big.
I saw that Google Photos had something quite similar to what I want to achieve. Just open Google Photos and click on an image, and as you might notice, the URL changes from https://photos.google.com to https://photos.google.com/photo/PHOTO_ID and an animation occurs.
Any idea on how Google does this or how I can do it? :)
Any help would be greatly appreciated!
The solutions I'd rather avoid are:
AJAX (but it's ok if Google uses it, and I doubt they do)
Having the HTML for both pages in a single, one file.
AngularJS (I'd prefer pure JS)
( this isn't a duplicate, I'd like to know how Google did it ;) )
You could use jQuery to load an HTML file into the body. Here is some very untested pseudo code to make this boneless, single-page-app work:
jQuery
//disable link action and load HTML inside the body tag
$('a').on('click', function(){
e.preventDefault();
$('body').load($(this).attr('href'));
}
HTML
<body>
<h1>title</h1>
link
</body>
If you wish to add an animation effect, you can prepend new HTML to the body, fade the previous HTML, then remove the hidden content.
While I'm not exactly sure of the method Google uses to achieve this, I do know that many of the solutions you would like to avoid are definitely some of your greater options.
Anyhow, a hack to achieve this would be splitting the code up amongst the two pages. Set up a fade out/any animation after a link is clicked on one page and make the other page fade in/any animation after load on the destination page. This is somewhat similar to how I would do it using an XML request, it's just a bit out of general practice.
Again this is a very 'hacky' method, but it gets the job done with very minimal JavaScript code, depending on how you go about it.
Im having a problem loading pages in wordpress with ajax. I have to make animated page transition, so i decided to use ajax and put page content into a div which i will animate into view. I created this logic, that works 50% of the time. There are generally a lot of weird bugs.
So my question did anyone create ajax page loader in wordpress? I read a bit about using ajax with wordpress, and that i had to use wordpress built in features, but I didn't get why is that. Also I don't know how to get the back button to work properly.
$( links ).click(function(e) {
var link = $(this).get(0).href;
$('body').append('<div class="contain-all"></div>');
$('.contain-all').load(link);
if(link!=window.location){
window.history.pushState({path: link},'',link);
}
e.preventDefault();
});
Hope somebody has the anserws I need. :)
Okay i read a bit about ajax in wordpress and loading pages, and you can achieve this by creating template parts which you will fetch by a function in wordpress functions.php, by calling it with ajax. It sounds complicated, (and it partly is), but you can read more about it here:
https://premium.wpmudev.org/blog/load-posts-ajax/
Also if anybody have questions they can ask them here, so everyone will have access to them.
Hello stack overflow community,
I am struggling to get this website to load quickly. It is a one page portfolio site running off the 'Simply' Theme available at Themeforest:
http://themeforest.net/item/simply-one-page-multipurpose-html-template/7788220?WT.ac=search_item&WT.oss_phrase=simply&WT.oss_rank=5&WT.z_author=AliA
With a video header and all of the other content below the header, we are looking at a 5 second load time.
What I am looking for is a way to load just the video header and navigation at first load, and after the video finishes loading and starts playing, the remaining content will start to load.
I am not all too familiar with Ajax or writing Javascript, but if I could get pointed in the right direction it would be greatly appreciated!
From what I've read so far, possibly the .load javascript might do the trick, but I have not found much information on it or where to start.
.load() includes a callback (see here) - so, assuming your content is all on the same domain, you just need to do something like this:
$(document).ready(function() {
$('#div_where_you_want_to_load_the_video').load(
'/path_to_video',
'#video_container',
function() {
//load the rest
}
);
});
Make sure you have jQuery loaded first.
We are new to Umbraco and coding within it, so I thank you in advance for your patience and assistance.
In short, we created a 'test' page utilizing a colorbox pop-up to display a form. It works perfectly in the test page.
When trying to integrate the code into Umbraco, when the "Request Info" button is clicked, the form opens in a full page, and the colorbox does not display.
I would appreciate any assistance that you could provide.
Test link (working):
http://online.saintleo.edu/Colorbox/Untitled-1.html
Example of a page where the "Request Info" button (yellow on right) opens full page, and NOT colorbox:
http://online.saintleo.edu/academics/masters-programs/master-of-accounting-(macc).aspx
I've spent the entire weekend trying to find the solution, hoping to get this resolved ASAP.
Thank you in advance, I appreciate your time and assistance.
This looks like a problem with how you have implemented your script in Umbraco. Just looking through Chrome's browser inspector, I can see that your script is failing to find the colorbox objects which means that something is prevent the library from being available. This is usually because a dependent javascript library has failed.
Looking at your source code, you are loading all your jQuery libraries at the bottom of your page. This is good practice, but you have placed your a second jQuery file reference, your colorbox file references and the custom colorbox code in the head of the page.
There are several things you will need to do:
Remove the jQuery reference from the head of the page;
Move the colorbox file references to the bottom of the page, after all the other javascript file references. You can leave the colorbox CSS file reference in the head.
Move the custom colorbox code to after all the other javascript file references. I usually place this kind of code in a separate file.
Depending on your Umbraco implementation:
If you are using masterpages, use a ContentPlaceholder to allow templates to drop javascript file references into the bottom of the page;
If you are using MVC views, use a footer section to do the same
I had to move my wordpress site to a different directory folder on my hosting server. Now for some reason on the portfolio pages of my website it's not displaying the thumbnail preview for lightbox images. The image will display when the thumbnail is clicked so I know it's pulling the right image from the right place but why is it not showing the preview thumbnail?
Here is a link:
Any help would be really appreciated!
You don't have the img src defined which PrettyPhoto uses to pull the thumb:
OK, well based on your comments the switch across from one server to another has stopped the method aq_resize() working. It is called Aqua-Resizer, here's the Github page;
https://github.com/sy4mil/Aqua-Resizer/blob/master/aq_resizer.php
The wiki on it explains it's use but if all you've done is change the server then you will have to look at other explanations for why it's not working. The following is a list you can start looking through;
Make sure your functions.php still has require_once('aq_resizer.php'); with the correct path to this script. Make sure the script is actually there. If it is try changing the file permissions on the file to see if that helps. If the script uses a cache directory try changing the permissions on this.
It could also be that the PHP version on the new server is different (maybe, I'm guessing now)? Check that too.