Author Topic: jQuery  (Read 2523 times)

0 Members and 1 Guest are viewing this topic.

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
jQuery
« on: February 06, 2015, 10:36:33 am »
Hello Peoples.

I am learning to code, and I'm actually finding it easier than I thought.

But, I am stuck on one problem. 

When using a jquery Slider.

I got it all working okay, except for one thing.  It stays to the left, even when enlarging the browser window.  I do have responsive code for it, so it changes when browser window is shrunk.

I tried using margin: auto; but that centers it in browser screen, and the slider is offset to the left to allow a text box on the right.  When it is margin: auto;, it overlaps the text box.

I also tried to set margin:auto; left: -229px and that works somewhat, but still doesn't scale right to browser size.

Is there a way to keep the left side of it aligned with the rest of the page when the browser resizes?  I tried doing a search for the code, but couldn't find it.  Maybe because I didn't know the right things to type into google.

Here's what I got for that slider box div line....

<div id="slider1_container" style="position: absolute; top: 365px; left: 0px; width: 800px; height: 456px; z-index: 100; background: #191919; overflow: ">

I have chosen a width of 1268 for the width of the webpage.  For webpages 1280 x ???? That extra 12px should allow for the slider bar on the right.

fyi, I tried to use relative as well, no difference.

Thanks in advance for your help, Codemasters!

 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 20732
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: jQuery
« Reply #1 on: February 06, 2015, 10:51:17 am »
I suggest you search this forum for other questions/responses about jQuery. If you don't find any then you might consider this is the wrong forum for your question.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: jQuery
« Reply #2 on: February 06, 2015, 10:55:36 am »
it probably is, but I know some people do coding here. And it is General Chat.

 

Offline vikasbly44

  • Contributor
  • !
  • Posts: 14
Re: jQuery
« Reply #3 on: February 06, 2015, 11:50:00 am »
 You can learn the best content of j-query from the popular site....

    www.w3schools.com
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: jQuery
« Reply #4 on: February 06, 2015, 02:19:40 pm »
Can you go to jsfiddle.net and write an example of what you are doing ? The fiddle site is good for code fiddling like this... for collaboration with others.  Once you've got something post a link here to the fiddle page.

At first glance: you probably don't want it to be position: absolute especially if you are also doing responsive coding and want it to flow with the rest of the page when you resize it.  Likely you will need to set the slider div to position: relative; display: inline-block and float: left; to keep it to the left when you resize. The inline display style should keep it from overlapping with the following text.

Try to avoid absolute unless you really need it. Anything that is positioned absolutely will not be in the regular flow of the page (obviously) and so you then have to resort to pixels to move stuff about, as you've tried.  You should leave that to the layout engine if you can.  Usually only headers and footers need to be absolutely positioned, to keep them at the top and bottom. 
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: jQuery
« Reply #5 on: February 07, 2015, 12:03:30 am »
well, I got it to work.

I put a padding on the right of the slider, and moved the navigation arrow, then I placed a background image on the right side and placed the Z-index higher so it sits on top of the padding of the slider.  Then I placed the text box on top of that.  Never everything moves correctly when the window resizes, except, when the window goes smaller, nothing else but the slider shrinks. I'll have to figure all that out later. for now I think it is fine.  I'm learning. Coding is still alot easier than I thought, but lots to learn.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf