Jump to content

"Let’s create a simple jQuery plugin"


justlukeyou

Recommended Posts

 http://crayonviolent.com/ItemSlider/  

 

but I mean..it's basically the exact same thing as the demo.. I literally just grabbed it from the "download the source" link on the original http://tympanus.net/codrops/2012/12/31/how-to-create-a-simple-multi-item-slider/ page, and uploaded it to my server. Didn't change anything at all.. 

Link to comment
Share on other sites

Hi,

 

Now the page just displays four rows of the images.

 

I notice that you have js/modernizr but I thought it would /js/mo...

 

	<script src="js/modernizr.custom.63321.js"></script>
I also don't understand how "main" can be be in the HTML but not in the CSS file. The same with "container".
Link to comment
Share on other sites

Hi,

 

Now the page just displays four rows of the images.

 

I don't know what to tell you.. it works fine on my site and on the demo site. All I can tell you is keep playing the "spot the difference" game. I noticed in the code you posted, you have the same 4 images in each set of ul tags..

 

 

I notice that you have js/modernizr but I thought it would /js/mo...

 

What? Are you talking about the leading "/" vs. not having it? Again I have to ask you, do you not understand how pathing works?

 

<script src="http://www.yoursite.com/path/to/script.js"></script> this is an absolute URL, and will point to the exact domain/path/to/file.

<script src="/path/to/script.js"></script> this is a relative URL. The leading "/" means to start at the web root.

<script src="path/to/script.js"></script> this is a relative URL. Without the leading "/", you are telling the browser to start in the directory the main page is located in.

 

So for example, my script is located at www.crayonviolent.com/ItemSlider/index.html

My js script includes show js/.. without the leading "/". This means the browser expects the js file to be located at www.crayonviolent.com/ItemSlider/js/.." If I had a leading "/", it would expect to find the js files at www.crayonviolent.com/js/..

 

Overall, it doesn't matter what the path is, nor what the filename is, as long as you are correctly pointing to it. This isn't even javascript..this is true for any link, image, anchor tag, script include, etc.. you have on your page. This is basic HTML.

 

 

I also don't understand how "main" can be be in the HTML but not in the CSS file. The same with "container".

 

What don't you understand? The demo script included a class for those containers. The fact that they didn't actually reference them in the css or js files means it's not relevant to the script. It's a common convention to add a class or id to your html elements, even if you aren't going to explicitly mark them up or reference them at the time. It makes it easier for other people to target or reference them for their own purposes later on down the road.

Link to comment
Share on other sites

Many thanks, I got this working. I reloaded the Javascript files and that sorted it but I cant remember changing the first files I uploaded.

 

I have also found this same code on a site that is trying to sell it.  Looks like they stole some free code to make money from it.  Naughty.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.