on clock javascript file don't work on publish

so i have this js file that responsible to 'on-click' events on some divs. on preview, that js (named: 'onclock events') works just fine and do what it meant to do (to color red on click). but when i publish to a server it doesn't work. what is wrong with it?.

one more thing, i added a transition-duration to that div css, to graduate the transition to red. it's not working at all (not on preview nor on publish).

it seems that i don't succeed to upload screenshots, so here is the code:

the js:

$("#1").click(function() { $(".gallerytab").toggleClass("mainblock"); });

$("#2").click(function() { $(".gallerytab").toggleClass("mainblock"); });

the css:

.gallerytab { transition-duration: 1s; background-color: #d6d5d2; width: 100%; height: 100%; padding: 0; margin: 1vmax; } .gallerytab.mainblock { transition-duration: 1s; background-color: red; }

// #1 and so on div is inside .gallerytab div

Don't know your answer sorry, but I can tell you how to do screenshots :)

You need to upload them to a server and link to them using the little "image" icon above the editing window here. It doesn't allow for uploading images or files, only linking to them. If you place just a link it will show up as a link. If you use the image icon of the editor, it will show it as an image.

Hope that helps :)


Looks like you need to change all your quotes to correct the error in the jquery ...

Forward and Backward quotes are not allowed.

thank you for your answers. i have tried to change the quotes all over again. i'm writing the code in the bss javascript and quote are generated as you type (completion), so they must be the correct ones. still there is no change. all work well on preview local, but not on publish.

Have you checked the file order of your JS files? Could be that maybe BSS is being a little more forgiving than the browser is? Just a thought.

thank you :) that was it. of course, correcting the order has created a whole other issues, but i'll handle them

hehe I hear ya, happens a lot. Hopefully in the future they will make the tree list reflect the order they will appear rather than alphabetical, but I'm glad it was an easy fix for the most part :)


It would be better, i.e. cleaner to create a single function that does repetitive operation than multiple functions that do the same thing over an over.

$(".clicked-item").click(function() {

If you click #1 it toggles the class and if then click #2 it toggles the class. But if you didn't click #2 but clicked #1 again it toggles the class.

So it's better to just add a class to all elements you want to toggle that class and build a single function for it rather than replicate the function for each different element that toggles the same class.