php, coldfusion and general web development waffle
Goto page Previous  1, 2, 3, 4, 5, 6 ... 9, 10, 11  Next
 
Post new topic   Reply to topic    Couchtripper Forum Index -> Tech news, tips and help
View previous topic :: View next topic  
Author Message
Brown Sauce



Joined: 07 Jan 2007

PostPosted: Sun Jan 13, 2013 12:26 pm    Post subject: Reply with quote

Laughing
Back to top
View user's profile Send private message
luke



Joined: 11 Feb 2007
Location: by the sea

PostPosted: Wed Jan 23, 2013 5:46 pm    Post subject: Reply with quote

i don't think theres a solution to this, but i'll ask just in case ...

i'm redoing a site at the moment, the original is in asp with an access database

the current site, and mine at the moment, displays document titles alphabetically, for example;

Guideline 01 - Appendix 01 - Principal UK Fishing Organisations
Guideline 01 - Appendix 02 - Principal Operational Regulations, Issue 4, May 2012
Guideline 01 - Appendix 03 - Fishing Claims forms & Guidance Notes
Guideline 01 - Appendix 04 - Guidance Fishing Reps, Issue 4, May 2012
Guideline 01 - Appendix 05 - Guidance Notes for Guard Vessels
Guideline 01 - Appendix 06 - Telecom Cable Works Notice, Issue 4, May 2012
Guideline 01 - Fishing Liaison, Issue 5, May 2012

so it just sorts by the field

but, they'd actually like the last item in that list to be the first ... because the appendixes should come after the main document

the only solution i can think of is they'd need to rename all the document titles so they are actually alphabetically correct, so 'Guideline 01 - Appendix 01 - Principal UK Fishing Organisations' would become 'Guideline 01 - Fishing Liaison, Issue 5, May 2012 - Appendix 01 - Principal UK Fishing Organisations' - but theres so many that it would take forever. theres no other solution though is there ... ?
Back to top
View user's profile Send private message
faceless
admin


Joined: 25 Apr 2006

PostPosted: Wed Jan 23, 2013 6:27 pm    Post subject: Reply with quote

Could you add an extra (hidden) field that could be used for setting the display sequence?
Back to top
View user's profile Send private message Send e-mail
luke



Joined: 11 Feb 2007
Location: by the sea

PostPosted: Thu Jan 24, 2013 1:37 pm    Post subject: Reply with quote

not really, i could do it - but as soon as new documents are added it would all go wrong, unless they had to add the sequence in for new documents, but i don't think i'd trust the users to maintain the correct sequence. theres hundreds of documents, they can be viewed all together or in document types, it would be a nightmare

i'm just going to tell them they'll have to type them alphabetically. i mean, they couldn't get excel, access or windows explorer to display their list like they want them ordered so why expect it of a web site?

the only thing i could think of is to have two document title fields, a main and secondary, so 'Guideline 01 - Fishing Liaison, Issue 5, May 2012 ' would be the main title, and this one wouldn't have a secondary title, the others would have the main title 'Guideline 01' with secondary titles 'Appendix 01 - Principal UK Fishing Organisations' etc, but that seems like a bit too much hassle!
Back to top
View user's profile Send private message
luke



Joined: 11 Feb 2007
Location: by the sea

PostPosted: Mon Mar 11, 2013 6:10 pm    Post subject: Reply with quote

i wonder if anyone can come up with a solution to this little problem ...

so i've got a long page, lets say different chapters going down. at the top i've got a jump to section 1, 2, 3 etc, and you click that to jump to that section

its just a basic <a>section 1</a> / <a>section 2</a> etc

with section 1 having a <a></a>

so clicking the section 1 link would move the page down so section 1 was positioned at the top of the browser window.

but instead of it being positioned at the top, i'd like it to be positioned where the mouse currently is ...any ideas?!

i had a google about but couldn't see anything. i did see something that made me think, you could put a padding-top on the <a> links styling, but the padding-top you'd want for this would be the pixels down the mouse currently is from the top of the browser window, so you'd have to use javascript/jquery i guess. when you click a section to jump to, you'd work out the mouse position, set the padding-top on the section you're going to that mouse position value, and then jump to the link - so you'd end up with the section being where your mouse currently is.

i think Laughing

anyone ever done anything like that? is it even possible? or have i got it completely wrong
Back to top
View user's profile Send private message
faceless
admin


Joined: 25 Apr 2006

PostPosted: Mon Mar 11, 2013 6:19 pm    Post subject: Reply with quote

yeah, I've been starting to add such tags into the galloway archive so that one day it will be easily searched

here's a page about it - it's really one of the oldest techniques about though!

http://www.davesite.com/webstation/html/chap09.shtml
Back to top
View user's profile Send private message Send e-mail
luke



Joined: 11 Feb 2007
Location: by the sea

PostPosted: Mon Mar 11, 2013 6:28 pm    Post subject: Reply with quote

sorry my code hasn't displayed quite right - the forum has removed bits!

but yeah, what you linked is what i'm doing at the moment, but what i want is when i click section 2 on that site - instead of section 2 moving to the top of the page, i want section 2 to move to where the mouse currently is ...
Back to top
View user's profile Send private message
Brown Sauce



Joined: 07 Jan 2007

PostPosted: Mon Mar 11, 2013 6:54 pm    Post subject: Reply with quote

you may need to find the co ordinates of the mouse position, and then move the section to that position, maybe you only need the y position?

here's a script to find the coordinates

http://dev-notes.com/code.php?q=33

maybe this

http://stackoverflow.com/questions/6088887/set-div-position-to-mouse-position-with-jquery

and

http://jsfiddle.net/mattball/haFMn/

works
Back to top
View user's profile Send private message
luke



Joined: 11 Feb 2007
Location: by the sea

PostPosted: Mon Mar 11, 2013 7:31 pm    Post subject: Reply with quote

thanks sauce, i think the javascript code will be more helpful than the jquery one - as i don't want to move a single div/element, i want the whole page to move to a certain position.

although looking at the javascript, its tracking the position within the whole page - i need to the mouse position not within the whole page, but within the current browser view area. so you could scroll to the bottom, move your mouse to the top of the viewing area ( without scrolling up ), and it would be 0 - where as that code calculates from the top of the page ...

if i could work out the position within the viewing area, and then change the padding-top of the a name based on the mouse x position ... i shall google
Back to top
View user's profile Send private message
luke



Joined: 11 Feb 2007
Location: by the sea

PostPosted: Mon Mar 11, 2013 8:02 pm    Post subject: Reply with quote

ignore everything i said about the padding, stupid idea - i just did a mock up and of course it puts a gap the size of the mouse position in the page layout ... i didn't think that through

back to the drawing board ...
Back to top
View user's profile Send private message
faceless
admin


Joined: 25 Apr 2006

PostPosted: Mon Mar 11, 2013 8:17 pm    Post subject: Reply with quote

when code doesn't display correctly, either wrap it in [code] tags, or click the 'disable HTML' option in the post reply page.
Back to top
View user's profile Send private message Send e-mail
luke



Joined: 11 Feb 2007
Location: by the sea

PostPosted: Mon Mar 11, 2013 10:38 pm    Post subject: Reply with quote

i did it Smile ( thanks to sauce's link to that js )

its all in this;

Code:
document.getElementById(e).style.top="-"+(event.clientY-10)+"px";


clientY is the pixel position within the browser - not the page

set the a names as position:relative, and when clicking the links, run the above js to set its top position ( e in the code above is the a name id ) and you're done. the extra 10 pixels was just to get the spacing of where i wanted to land spot on.

i'm not sure what would happen on a tablet or touch phone, i don't know if the tap of your finger would register as a mouse position ...
Back to top
View user's profile Send private message
faceless
admin


Joined: 25 Apr 2006

PostPosted: Wed Mar 13, 2013 2:53 am    Post subject: Reply with quote

It sounds like a neat idea from what I can gather, but I'm not entirely sure how it will work - can you post an example page that uses it?

is it similar to the navigation bar on the page here? I quite like that because the movement of it attracts the eye, so people know it's there
Back to top
View user's profile Send private message Send e-mail
luke



Joined: 11 Feb 2007
Location: by the sea

PostPosted: Wed Mar 13, 2013 12:06 pm    Post subject: Reply with quote

sorry, i don't think i explained it very well, its nothing as fancy as that!

its stupid really, and i'd not even noticed it in 16 years - and its not something i'll probably use again, its just this one client wasn't keen and it got me thinking if it could be done

this is what he didn't like - the standard 'a name' and 'a href=#'

click say section 2, and section 2 will move to the top of the screen - but your mouse is over section 3

this is with the solution with the javascript;

click section 2, and section 2 moves to where your mouse is

theres a slight change in the code from what i posted, what i posted didn't work in firefox or ie - but worked in chrome, safari and opera. the new code works in all of them.
Back to top
View user's profile Send private message
Brown Sauce



Joined: 07 Jan 2007

PostPosted: Wed Mar 13, 2013 2:46 pm    Post subject: Reply with quote

Looks good though, maybe it's the sort of thing that's used in photo galleries, but horizontally and with some delay ..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Couchtripper Forum Index -> Tech news, tips and help All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6 ... 9, 10, 11  Next
Page 5 of 11

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Couchtripper - 2005-2015